如何在WinForms中的两个图像之间绘制箭头?
我必须这样做:在画布上的两个图像之间绘制一个箭头,因此当我单击带有箭头的按钮时,我单击一个图像以将箭头粘贴到其上,然后绘制箭头只要我需要并将其粘贴到第二张图片中。
I have to do this: to draw an arrow between two images from my canvas, so when I click the button with the arrow on it and I put click on one image to paste the arrow on it and then to draw the arrow as long as i need and to paste it to the second image.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要用两点绘制圆弧,您需要一个预定义的角度。我想你已经弄清楚了那部分。
为此,您需要绘制两条弧线,每个图像中各一条。弧线将比每个图像都大,但在第一个图像中,您可以将其剪裁在弧线退出图像并朝向第二个点的位置。
在第二个图像中,您需要将圆弧偏移两个图像原点之间的 x 和 y 距离。然后在第二张图像中从第一个点到第二个点绘制圆弧,并剪掉图像外部的部分。
如果您需要橡皮筋弧,则必须在鼠标移动时擦除并重新绘制它。如果您想在图像之间的表单上的空间上绘图,可以使用适当的偏移量来实现。
To draw an arc with two points, you'll need a predefined angle. I assume you have that part figured out.
To do this, you need to draw two arcs, one in each image. The arc will be bigger than each image, but in the first image you can just clip it where the arc exits the image going toward the second point.
In the second image, you need to offset the arc by the x and y distance between the origins of the two images. Then draw the arc in the second image from the first point to the second point and clip that part that is outside the image.
If you need a rubber band arc, you'll have to erase and redraw it whenever the mouse moves. If you want to draw on the space on the form between the images, you can do that using the proper offset.
你有两个点,所以你可以画一条线。试试这个:
和代码:
You have two point, so you can draw a line. Try this:
and the code:
和代码
and the code