应该是windowsForms吧。
下面是绘一个矩形:
Graphics g = panel1.CreateGraphics();
Pen pen = new Pen(Brushes.Red,3);
Rectangle r=new Rectangle();
r.Width=r.Height=200;
r.Location = new Point(2, 2);
g.DrawRectangle(pen,r);
其中pen中的3决定线条的粗细。
放一个几个pictureBox控件,控件中分别放一个图
点击每个pictureBox,产生pictureBox1_Click事件,根据每张图片的显示,为pen的第二个参数赋值。
每次赋值后别忘了刷新。
Graphics g;
Pen pen = new Pen(Brushes.Red,8);
Rectangle r=new Rectangle();
private void button1_Click(object sender, EventArgs e)
{
pen.Width = 1;
huitu();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
pen.Width = 1;
huitu();
}
public void huitu()
{
g = panel1.CreateGraphics();
r.Width = r.Height = 200;
r.Location = new Point(2, 2);
g.DrawRectangle(pen, r);
}
多线程?