[quote=291655:@Jeff Tullin]Steve:
Open the Xojo example project called Obj2DTextRotation
Look in the Canvas Paint Event
You will see the event has this code:
[code]Const pi = 3.14159
Dim ss As New StringShape
ss.Text = DisplayTextField.Text
ss.TextSize = 24
ss.Rotation = RotationSlider.Value * (pi/180)
g.DrawObject(ss, g.Width\2, g.Height\2)[/code]
The stringshape is defined inside the event but more on that later.
lets add a line:
[code]Const pi = 3.14159
Dim ss As New StringShape
ss.Text = DisplayTextField.Text
ss.TextSize = 24
ss.Rotation = RotationSlider.Value * (pi/180)
g.DrawObject(ss, g.Width\2, g.Height\2)
dim lin as new curveshape
lin.X = 10
lin.y = 10
lin.x2 = 200
lin.y2 = 200
g.DrawObject(lin, 20,20)
[/code]
Now the line draws too.
lets put these things into a group, and draw the group instead:
[code]Const pi = 3.14159
Dim ss As New StringShape
ss.Text = DisplayTextField.Text
ss.TextSize = 24
ss.Rotation = RotationSlider.Value * (pi/180)
//g.DrawObject(ss, g.Width\2, g.Height\2)
dim lin as new curveshape
lin.X = 10
lin.y = 10
lin.x2 = 200
lin.y2 = 200
//g.DrawObject(lin, 20,20)
dim g2d as new Group2D
g2d.Append ss
g2d.Append lin
g.drawobject g2d,g.Width\2, g.Height\2
[/code]
let’s scale this to half the size:
dim g2d as new Group2D
g2d.Append ss
g2d.Append lin
g2d.Scale = 0.5
g.drawobject g2d,g.Width\\2, g.Height\\2
Now, the only thing we need to do is move the Group2D object out of the Paint event, (make it a property of the window) and fill it in our ‘create graph’ code.
Assuming it is populated elsewhere, the whole of the code above in the Paint Event becomes:
Sub Paint(g as graphics)
g.drawobject g2d,g.Width\\2, g.Height\\2
end sub
And the whole group is redrawn when the canvas needs to be refreshed[/quote]
Thanks muchly for that Jeff. I’ll carefully go through it this weekend. My problem (well, one of them) is that I’m coming home from a hard days work of mental torture, then trying to work on and comprehend issues with my program. Last weekend I spent around 8hrs on Saturday and Sunday and finally resolved some other issues with the program.
Things take time and time seems to be getting harder to find.
When I was 35, it was a very good year, It was a very good year for blue blooded girls of independent means - we’d ride in limousines, their chauffeurs would drive, when I was 35.