画图。图片,文本,圆弧
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
1
//画文本
2
public void I_GE_Base.Draw()
3![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
4
5
Graphics g = SDP_Graph.SDP_Main.bg_buf.Graphics;
6
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias;
7
//消除锯齿
8
9
float x = this.m_Point.X;
10
float y = this.m_Point.Y;
11
12![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (m_Num == 2)
{
13
14
TextDialog td = new TextDialog();
15
16![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (td.ShowDialog() == DialogResult.OK)
{
17
this.m_Data = td.TheText;
18
this.m_Brush = new SolidBrush(td.TheColor);
19
this.m_Font = td.TheFont;
20
//Dim drawBrush As New SolidBrush(td.TheColor)
21
g.DrawString(m_Data, m_Font, m_Brush, x, y);
22
m_Num = 0;
23
}
24
}
25
26![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (m_Num == 1)
{
27![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (this.m_Data != "")
{
28
g.DrawString(m_Data, m_Font, m_Brush, x, y);
29
}
30
}
31
32
}
33![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
1
//文本类
2
public class TextDialog
3![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
4
5
private string _text;
6
7![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public string TheText
{
8![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
get
{ return _text; }
9![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
set
{ _text = value; }
10
}
11
12
private Font _font;
13
14![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public Font TheFont
{
15![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
get
{ return _font; }
16![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
set
{ _font = value; }
17
}
18
19
private Color _color;
20
21![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
public Color TheColor
{
22![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
get
{ return _color; }
23![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
set
{ _color = value; }
24
}
25
26
27
private void TextDialog_Load(object sender, System.EventArgs e)
28![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
29
_color = Color.Black;
30
_font = txtTheText.Font;
31
_text = "";
32
}
33
34
private void btnOK_Click(object sender, System.EventArgs e)
35![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
36
_text = txtTheText.Text;
37
}
38
39
private void btnFont_Click(object sender, System.EventArgs e)
40![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
41
dlgFont.AllowSimulations = true;
42
dlgFont.AllowVectorFonts = true;
43
dlgFont.AllowVerticalFonts = true;
44
dlgFont.MaxSize = 200;
45
dlgFont.MinSize = 4;
46
dlgFont.ShowApply = false;
47
dlgFont.ShowColor = true;
48
dlgFont.ShowEffects = true;
49![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (dlgFont.ShowDialog() == Windows.Forms.DialogResult.OK)
{
50
_font = dlgFont.Font;
51
_color = dlgFont.Color;
52
txtTheText.Font = _font;
53
txtTheText.ForeColor = _color;
54
}
55
}
56
}
57![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
1
//画图片
2
public void I_GE_Base.Draw()
3![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
4
Point PtStart;
5
Size RectSize;
6
Graphics g = SDP_Graph.SDP_Main.bg_buf.Graphics;
7
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias;
8
//消除锯齿
9![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (m_End.X > m_Point.X & m_End.Y > m_Point.Y)
{
10
PtStart = new Point(m_Point.X, m_Point.Y);
11
RectSize = new Size(m_End.X - m_Point.X, m_End.Y - m_Point.Y);
12
}
13![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
else if (m_End.X > m_Point.X & m_End.Y < m_Point.Y)
{
14
PtStart = new Point(m_Point.X, m_Point.Y);
15
RectSize = new Size(m_End.X - m_Point.X, m_Point.Y - m_End.Y);
16
}
17![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
else if (m_End.X < m_Point.X & m_End.Y > m_Point.Y)
{
18
PtStart = new Point(m_End.X, m_Point.Y);
19
RectSize = new Size(m_Point.X - m_End.X, m_End.Y - m_Point.Y);
20
}
21![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
else if (m_End.X < m_Point.X & m_End.Y < m_Point.Y)
{
22
PtStart = new Point(m_End.X, m_End.Y);
23
RectSize = new Size(m_Point.X - m_End.X, m_Point.Y - m_End.Y);
24
}
25
26
Image newImage = Image.FromFile("E:\\\\Documents and Settings\\\\Administrator\\\\桌面\\\\qtzyb_b.gif");
27
28![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (m_Num == 1)
{
29
g.DrawRectangle(Pens.Blue, PtStart.X, PtStart.Y, RectSize.Width, RectSize.Height);
30
}
31
32![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (m_Num == 2)
{
33
g.DrawImage(newImage, PtStart.X, PtStart.Y, RectSize.Width, RectSize.Height);
34
}
35
36
}
37![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)