1.GDI+命名空间:System.Drawng. System.Drawng.Text. System.Printing. System.Drawing.Imaging. System.Draming.Drawing2D。 System.Drawing.Design
一 .Graphics(画板)对象,
创建graphics的方法:1.利用窗体或控件的Paint事件的参数PaintEventArgs:
Private void Form1_Paint(object sender,System.EventArgs e)
{
Graphics g=e.Graphics;
}
2. s使用窗体或控件的CreateGraphics的方法,用于对想一存在的情况下:
Graphics g;
g=this.CreateGraphics();
3.LinearGradientBrush(颜色渐变画刷)
linearGradientBrush ff=new LinearGradientBrush(new Point(),new Point(),Color.red,Color,Blue)
4.Font 建立之后不能修改 必须重新建立新的对象。
常用属性: Bold Italic Regular,Strikeout,Underline
三。画椭圆
Graphics g = e.Graphics;
Pen p = new Pen(Color.Red, 20);
g.DrawEllipse(p, 1, 2, 50, 30);
Rectangle r = new Rectangle(52, 25, 136, 40);
g.DrawEllipse(p, r);
画多边形:
Graphics g = e.Graphics;
Pen p = new Pen(Color.Red, 20);
g.DrawEllipse(p, 1, 2, 50, 30);
Rectangle r = new Rectangle(52, 25, 136, 40);
g.DrawEllipse(p, r);
Point p1 = new Point(50, 50);
Point p2 = new Point(15, 50);
Point p3 = new Point(150, 50);
Point p4 = new Point(120, 50);
Point p5 = new Point(25, 50);
Point p6 = new Point(50, 65);
Point[] curvePont = {p1,p2,p3,p4,p5 };
g.DrawPolygon(p, curvePont);
二。Pen对象的创建的方式
1, Pen p1=new Pen(Color);
2.Pen p2=new Pen(Brush);
3Pen p3=new Pen(Brush,float);带宽度刷子
4.Pen p4=new Pen(Color,Red);颜色和像
三。Brush对象(画刷) 用来填充图形,是抽象类,不能实例化,只能使用它派生
1. SolidBrush(单色画刷)
SolidBrush ff=new SolidBrush(Color.red)
2.HatchBrush(阴影画刷)
HatchStyle ff = new HatchStyle(HatchStyle.Cross, Color.Blue, Color.Red);