问题
I can find plenty of examples of how to draw a line in vb.net online.
I however I cannot find any examples of how to draw lines at a specific angle.
Could someone tell me how to do this?
回答1:
You'll need to do a bit of math using sin
/cos
.
x1
, y1
= starting position of lineangleInRadians
= angle on the line converted to Radians
x2 = lineLength * Math.Cos(angleInRadians) + x1
y2 = lineLength * Math.Sin(angleInRadians) + y1
Then you can draw a line from (x1
, y1
) to (x2
, y2
).
来源:https://stackoverflow.com/questions/16215247/drawing-lines-at-angle-vb-net