GDIDrawing2 —— GDI+绘图(二)
1
using System;
2
using System.Drawing;
3
using System.Collections;
4
using System.ComponentModel;
5
using System.Windows.Forms;
6
using System.Data;
7![]()
8
namespace GDIDrawing2
9
{
10
/// <summary>
11
/// GDIDrawing2 —— 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
Pen blackPen= new Pen(Color.Black, 3);
77
g.DrawArc(blackPen, 0, 0, 100, 200, 45, 270);
78
Rectangle r1 = new Rectangle(110, 0, 210, 200);
79
g.DrawArc(blackPen, r1, 45, 270);
80
g.DrawEllipse(blackPen, 50, 50, 200, 200);
81
g.DrawEllipse(blackPen, 180, 50, 220, 80);
82
Rectangle r2 = new Rectangle(270, 60, 50, 200);
83
g.DrawEllipse(blackPen, r2);
84
g.DrawPie(blackPen, 20, 50, 120, 100, 30, 240);
85
Rectangle r3 = new Rectangle(260, 150, 100, 100);
86
g.DrawPie(blackPen, r3, 0, 130);
87
}
88
}
89
}
90![]()
using System;2
using System.Drawing;3
using System.Collections;4
using System.ComponentModel;5
using System.Windows.Forms;6
using System.Data;7

8
namespace GDIDrawing29
{10
/// <summary>11
/// GDIDrawing2 —— GDI+绘图(二)。12
/// </summary>13
public class Form1 : System.Windows.Forms.Form14
{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 code63

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
Pen blackPen= new Pen(Color.Black, 3);77
g.DrawArc(blackPen, 0, 0, 100, 200, 45, 270);78
Rectangle r1 = new Rectangle(110, 0, 210, 200);79
g.DrawArc(blackPen, r1, 45, 270);80
g.DrawEllipse(blackPen, 50, 50, 200, 200);81
g.DrawEllipse(blackPen, 180, 50, 220, 80);82
Rectangle r2 = new Rectangle(270, 60, 50, 200);83
g.DrawEllipse(blackPen, r2);84
g.DrawPie(blackPen, 20, 50, 120, 100, 30, 240);85
Rectangle r3 = new Rectangle(260, 150, 100, 100);86
g.DrawPie(blackPen, r3, 0, 130);87
}88
}89
}90



浙公网安备 33010602011771号