枪炮 你没明白我意思,,,我是对于你这个重构的控件有点不理解,所以我不知道该怎么传递参数。
首先我的实际情况中,没有
int X = 50;
int Y = 50;
int MoveY = 5;
Y += MoveY;
if (Y >= this.Height)
Y = 50;
有的是从设备传递过来的参数,如果我使用你的控件,按照你的DrawRender函数,那么我需要
Graphics gs = this.你重构的PIC控件.CreateGraphics();
//gs.Clear(Color.Black);
Pen p = new Pen(Color.Red, 10);
gs.FillRectangle(new SolidBrush(Color.Black), 0, 0, this.pictureBox1.Width, this.pictureBox1.Height);
gs.DrawRectangle(p, 10f, Y0, 1.5f, 10f);
gs.DrawRectangle(p, 40f, Y1, 1.5f, 10f);
gs.DrawRectangle(p, 80f, Y2, 1.5f, 10f);
gs.DrawRectangle(p, 120f, Y3, 1.5f, 10f);
gs.DrawRectangle(p, 160f, Y4, 1.5f, 10f);
gs.DrawRectangle(p, 200f, Y5, 1.5f, 10f);
gs.DrawRectangle(p, 240f, Y6, 1.5f, 10f);
gs.DrawRectangle(p, 280f, Y7, 1.5f, 20f);
gs.DrawRectangle(p, 320f, Y8, 1.5f, 40f);
gs.DrawRectangle(p, 360f, Y9, 1.5f, 10f);
gs.DrawRectangle(p, 400f, Y10, 1.5f, 10f);
gs.DrawRectangle(p, 440f, Y11, 1.5f, 30f);
gs.DrawRectangle(p, 480f, Y12, 1.5f, 10f);
gs.DrawRectangle(p, 520f, Y13, 1.5f, 10f);
gs.DrawRectangle(p, 550f, Y14, 1.5f, 20f);
gs.DrawRectangle(p, 580f, Y15, 1.5f, 10f);
this.pictureBoxEx21.DrawRender(gs);
this.pictureBoxEx21.Render();
想让你看看这样实现对不对 ,因为我修改了一下控件 发现红色快的坐标不是移动 而是连起来了,
就差那么一丢丢,我就完成了。你这个DEMO确实没有闪烁问题