GDI+中区域的定义和绘制
2009-11-07 19:12
295 查看
GDI+中区域的定义和绘制
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
namespace 区域
...{
/**//// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
...{
/**//// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
...{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/**//// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
...{
if( disposing )
...{
if (components != null)
...{
components.Dispose();
}
}
base.Dispose( disposing );
}
Windows Form Designer generated code#region Windows Form Designer generated code
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
...{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(632, 526);
this.Name = "Form1";
this.Text = "区域";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
...{
Application.Run(new Form1());
}
protected override void OnPaint(PaintEventArgs e)
...{
Graphics g= e.Graphics;
g.FillRectangle(Brushes.White, this.ClientRectangle);
Region r1=new Region(new RectangleF(60, 50, 150, 100));
GraphicsPath gp=new GraphicsPath();
gp.AddLine(300, 50, 500, 100);
gp.AddLine(500, 100, 400, 200);
gp.CloseFigure();
gp.StartFigure();
gp.AddEllipse(50, 200, 200, 100);
Region r2=new Region(gp);
g.FillRegion(Brushes.CornflowerBlue, r1);
g.FillRegion(Brushes.DarkOrange, r2);
r1.Dispose();
r2.Dispose();
gp.Dispose();
}
private void Form1_Load(object sender, System.EventArgs e)
...{
}
}
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
namespace 区域
...{
/**//// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
...{
/**//// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
...{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/**//// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
...{
if( disposing )
...{
if (components != null)
...{
components.Dispose();
}
}
base.Dispose( disposing );
}
Windows Form Designer generated code#region Windows Form Designer generated code
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
...{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(632, 526);
this.Name = "Form1";
this.Text = "区域";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
/**//// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
...{
Application.Run(new Form1());
}
protected override void OnPaint(PaintEventArgs e)
...{
Graphics g= e.Graphics;
g.FillRectangle(Brushes.White, this.ClientRectangle);
Region r1=new Region(new RectangleF(60, 50, 150, 100));
GraphicsPath gp=new GraphicsPath();
gp.AddLine(300, 50, 500, 100);
gp.AddLine(500, 100, 400, 200);
gp.CloseFigure();
gp.StartFigure();
gp.AddEllipse(50, 200, 200, 100);
Region r2=new Region(gp);
g.FillRegion(Brushes.CornflowerBlue, r1);
g.FillRegion(Brushes.DarkOrange, r2);
r1.Dispose();
r2.Dispose();
gp.Dispose();
}
private void Form1_Load(object sender, System.EventArgs e)
...{
}
}
}
相关文章推荐
- GDI+中路径的定义和绘制
- jsp iframe 定义一块区域
- 第五章 图像基础(绘制填入区域)
- 使用网页代码“截取”功能,打印页面某段定义区域内容
- Halcon学习之八:图像区域叠加与绘制
- [good]opencv2 使用鼠标绘制矩形并截取和保存矩形区域图像
- 使用GDI+绘制旋转的图形及图片
- 转载:GDI+绘制文字的位置偏移分析
- GDI+ 绘制Png
- C#中使用GDI+绘制辉光效果文字
- opencv鼠标绘制矩形和截取图像的矩形区域
- 再学 GDI+[30]: TGPPen - 用画刷定义的画笔
- 再学 GDI+[72]: 区域(1) - 建立区域
- 再学 GDI+[78]: 区域(7) - Translate - 区域的平移变换
- 只拍摄SurfaceView预览界面特定区域内容(矩形框)---完整实现(原理:底层SurfaceView+上层绘制ImageView)
- 用GDI+怎么实现绘制倾斜文字
- GDI+编程---图形绘制概述
- 【转载】MRP区域“MRP Area”的定义以及作用
- MFC中使用GDI+绘制自定义的控件
- 使用GDI+绘制高质量图和字体