Hi all.
My head hurts.
I have a rectangle, and I need a thick line from corner to corner.
If the line goes down towards the right, I can do it:
width and height are a rectangle
g is a canvas graphics from a paint event
This works for lines that are \
[code]Dim r as New RoundRectShape
r.width=sqrt((width)^2 + (height)^2)
angle = acos( (width) / r.width)
r.height=14
r.border=100
r.bordercolor=&c000000
r.fillcolor=&cffffff
r.cornerHeight=14
r.cornerWidth=14
r.borderwidth=2
r.x = left+ width/2
r.y = top+height/2
r.rotation = angle
g.DrawObject r[/code]
But for lines that are / I cannot work out what the angle should be.
I get close, but when the rectangle isn’t a square, the rotation is wrong
[code]Dim r as New RoundRectShape
r.width=sqrt((width)^2 + (height)^2)
angle = acos( (width) / r.width) //what goes here?
//I have tried angle + 3.14159
//(3.14159*2) - angle
// and more
r.height=14
r.border=100
r.bordercolor=&c000000
r.fillcolor=&cffffff
r.cornerHeight=14
r.cornerWidth=14
r.borderwidth=2
r.x = left+ width/2
r.y = top+height/2
r.rotation = angle
g.DrawObject r[/code]
Any maths whiz out there?