本文介绍了如何在控件上绘制线条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个控制面板,并包含不同的picturbox来显示控件上的图片。这些picturbox也可以使用多线程移动。我想要画出每张照片的移动路径。请。
请给我任何建议。
代码如下。 agentbox是picturbox; ratimage是每个图片框的位图图片。
Hi ,
i have a control panel, and contains different picturbox to display pictures on the control. these picturboxs also moveable using Multithreading. i want that to draw the path of movement of each picture. please.
any suggestion please.
code is given below. agentbox is picturbox; ratimage is bitmap image for each picturebox.
}
Graphics g = Graphics.FromImage(ratImage);
Pen pColor = new Pen(Color .Black );
pColor.Width = 3;
Brush bb = pColor.Brush;
g.FillEllipse(bb, new Rectangle(new Point(agentBox.Width / 2, agentBox.Height / 2), new Size(20, 20)));
this.agentBox.Image = ratImage;
this.agentBox.SizeMode = PictureBoxSizeMode.StretchImage;
agentBox.Left = p.X;
agentBox.Top = p.Y;
Graphics gControlPanle = panel101.CreateGraphics();
GraphicsPath agentPath = new GraphicsPath();
agentPath.AddLine(this.fromPoint , this.toPoint );
agentPath.FillMode = FillMode.Winding;
gControlPanle.DrawPath(pColor, agentPath);
}
推荐答案
这篇关于如何在控件上绘制线条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!