public GDITest1() { InitializeComponent(); } private void GDITest1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; //创建画板,这里的画板是由Form提供的. Pen p = new Pen(Color.Gray, 2);//定义了一个蓝色,宽度为的画笔 g.DrawLine(p, 10, 10, 100, 100);//在画板上画直线,起始坐标为(10,10),终点坐标为(100,100) //g.DrawRectangle(p, 10, 10, 100, 100);//在画板上画矩形,起始坐标为(10,10),宽为,高为 int i = 0; while (i <10) { i++; int f = i * 10; g.DrawEllipse(p, f, f, f, f);//在画板上画椭圆,起始坐标为(10,10),外接矩形的宽为,高为 Thread.Sleep(1000); } }
Winform GDI 系列(1) 使用GDI 画线画圈
猜你喜欢
转载自blog.csdn.net/u010919083/article/details/79351687
今日推荐
周排行