Drawing lines at angle vb.net [closed]

别说谁变了你拦得住时间么 提交于 2019-12-13 07:24:17

问题


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 line
angleInRadians = 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!