1个回答
展开全部
如果想画一个圆点
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0, 0, 10, 10));//画实心椭圆
大小可以自己改
这个方法可以在Form的paint事件里调用
其他的画法:
System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red);//画笔
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0,0,100,200));//画实心椭圆
formGraphics.DrawEllipse(myPen, new Rectangle(0,0,100,200));//空心圆
formGraphics.FillRectangle(myBrush, new Rectangle(0,0,100,200));//画实心方
formGraphics.DrawRectangle(myPen, new Rectangle(0,0,100,200));//空心矩形
formGraphics.DrawLine(myPen, 0, 0, 200, 200);//画线
formGraphics.DrawPie(myPen,90,80,140,40,120,100); //画馅饼图形 //画多边形
formGraphics.DrawPolygon(myPen,new Point[]{ new Point(30,140), new Point(270,250), new Point(110,240), new Point (200,170), new Point(70,350), new Point(50,200)}); //清理使用的资源 myPen.Dispose(); myBrush.Dispose(); formGraphics.Dispose();
可以根据需要自己设计
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0, 0, 10, 10));//画实心椭圆
大小可以自己改
这个方法可以在Form的paint事件里调用
其他的画法:
System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red);//画笔
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);//画刷
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0,0,100,200));//画实心椭圆
formGraphics.DrawEllipse(myPen, new Rectangle(0,0,100,200));//空心圆
formGraphics.FillRectangle(myBrush, new Rectangle(0,0,100,200));//画实心方
formGraphics.DrawRectangle(myPen, new Rectangle(0,0,100,200));//空心矩形
formGraphics.DrawLine(myPen, 0, 0, 200, 200);//画线
formGraphics.DrawPie(myPen,90,80,140,40,120,100); //画馅饼图形 //画多边形
formGraphics.DrawPolygon(myPen,new Point[]{ new Point(30,140), new Point(270,250), new Point(110,240), new Point (200,170), new Point(70,350), new Point(50,200)}); //清理使用的资源 myPen.Dispose(); myBrush.Dispose(); formGraphics.Dispose();
可以根据需要自己设计
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询