GDIDrawing3——GDI+绘图(三)
生活随笔
收集整理的這篇文章主要介紹了
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#region?Windows?Form?Designer?generated?code
43????????/**////?<summary>
44????????///?設計器支持所需的方法?-?不要使用代碼編輯器修改
45????????///?此方法的內容。
46????????///?</summary>
47????????private?void?InitializeComponent()
48????????{
49????????????//?
50????????????//?Form1
51????????????//?
52????????????this.AutoScaleBaseSize?=?new?System.Drawing.Size(8,?18);
53????????????this.ClientSize?=?new?System.Drawing.Size(440,?320);
54????????????this.FormBorderStyle?=?System.Windows.Forms.FormBorderStyle.FixedDialog;
55????????????this.MaximizeBox?=?false;
56????????????this.Name?=?"Form1";
57????????????this.StartPosition?=?System.Windows.Forms.FormStartPosition.CenterScreen;
58????????????this.Text?=?"GDIDrawing3";
59????????????this.Paint?+=?new?System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
60
61????????}
62????????#endregion
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,?0,?0,?100,?60);
78????????????g.FillPie(redBrush,?100,?0,?100,?70,?30,?300);
79????????????g.FillRectangle(redBrush,?200,?10,?100,?50);
80????????????Point[]?points?=
81????????????????{
82????????????????????new?Point(0,?100),
83????????????????????new?Point(20,?120),
84????????????????????new?Point(50,?100),
85????????????????????new?Point(60,?200),
86????????????????????new?Point(30,?220),
87????????????????????new?Point(180,?200),
88????????????????????new?Point(20,?110),
89????????????????????new?Point(0,?220)
90????????????????};
91????????????g.FillPolygon(redBrush,?points);
92????????????Rectangle?fillRect?=?new?Rectangle(200,?100,?200,?200);
93????????????Region?fillRegion?=?new?Region(fillRect);
94????????????g.FillRegion(redBrush,?fillRegion);
95????????}
96????}
97}
98
?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#region?Windows?Form?Designer?generated?code
43????????/**////?<summary>
44????????///?設計器支持所需的方法?-?不要使用代碼編輯器修改
45????????///?此方法的內容。
46????????///?</summary>
47????????private?void?InitializeComponent()
48????????{
49????????????//?
50????????????//?Form1
51????????????//?
52????????????this.AutoScaleBaseSize?=?new?System.Drawing.Size(8,?18);
53????????????this.ClientSize?=?new?System.Drawing.Size(440,?320);
54????????????this.FormBorderStyle?=?System.Windows.Forms.FormBorderStyle.FixedDialog;
55????????????this.MaximizeBox?=?false;
56????????????this.Name?=?"Form1";
57????????????this.StartPosition?=?System.Windows.Forms.FormStartPosition.CenterScreen;
58????????????this.Text?=?"GDIDrawing3";
59????????????this.Paint?+=?new?System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
60
61????????}
62????????#endregion
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,?0,?0,?100,?60);
78????????????g.FillPie(redBrush,?100,?0,?100,?70,?30,?300);
79????????????g.FillRectangle(redBrush,?200,?10,?100,?50);
80????????????Point[]?points?=
81????????????????{
82????????????????????new?Point(0,?100),
83????????????????????new?Point(20,?120),
84????????????????????new?Point(50,?100),
85????????????????????new?Point(60,?200),
86????????????????????new?Point(30,?220),
87????????????????????new?Point(180,?200),
88????????????????????new?Point(20,?110),
89????????????????????new?Point(0,?220)
90????????????????};
91????????????g.FillPolygon(redBrush,?points);
92????????????Rectangle?fillRect?=?new?Rectangle(200,?100,?200,?200);
93????????????Region?fillRegion?=?new?Region(fillRect);
94????????????g.FillRegion(redBrush,?fillRegion);
95????????}
96????}
97}
98
轉載于:https://www.cnblogs.com/gofficer/archive/2007/08/22/865304.html
總結
以上是生活随笔為你收集整理的GDIDrawing3——GDI+绘图(三)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 有一整片蓝天 停住时间。
- 下一篇: 28句话让你的人际关系更上一层楼