GDIDrawing3——GDI+绘图(三)

 1using System;
 2using System.Drawing;
 3using System.Collections;
 4using System.ComponentModel;
 5using System.Windows.Forms;
 6using System.Data;
 7
 8namespace GDIDrawing3
 9{
10    /// <summary>
11    /// GDIDrawing3——GDI+绘图。
12    /// </summary>

13    public class Form1 : System.Windows.Forms.Form
14    {
15        /// <summary>
16        /// 必需的设计器变量。
17        /// </summary>

18        private System.ComponentModel.Container components = null;
19
20        public Form1()
21        {
22            // Windows 窗体设计器支持所必需的
23            InitializeComponent();
24            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
25        }

26
27        /// <summary>
28        /// 清理所有正在使用的资源。
29        /// </summary>

30        protected override void Dispose( bool disposing )
31        {
32            if( disposing )
33            {
34                if (components != null
35                {
36                    components.Dispose();
37                }

38            }

39            base.Dispose( disposing );
40        }

41
42        Windows Form Designer generated code
63
64        /// <summary>
65        /// 应用程序的主入口点。
66        /// </summary>

67        [STAThread]
68        static void Main() 
69        {
70            Application.Run(new Form1());
71        }

72        // 处理窗体显示事件。
73        private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
74        {
75            Graphics g = e.Graphics;
76            SolidBrush redBrush = new SolidBrush(Color.Red);
77            g.FillEllipse(redBrush, 0010060);
78            g.FillPie(redBrush, 10001007030300);
79            g.FillRectangle(redBrush, 2001010050);
80            Point[] points =
81                {
82                    new Point(0100),
83                    new Point(20120),
84                    new Point(50100),
85                    new Point(60200),
86                    new Point(30220),
87                    new Point(180200),
88                    new Point(20110),
89                    new Point(0220)
90                }
;
91            g.FillPolygon(redBrush, points);
92            Rectangle fillRect = new Rectangle(200100200200);
93            Region fillRegion = new Region(fillRect);
94            g.FillRegion(redBrush, fillRegion);
95        }

96    }

97}

98
posted on 2007-08-22 14:14  Gofficer  阅读(310)  评论(0)    收藏  举报