惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
V
Visual Studio Blog
Martin Fowler
Martin Fowler
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 叶小钗
I
InfoQ
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
P
Proofpoint News Feed
WordPress大学
WordPress大学
小众软件
小众软件
B
Blog
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
量子位
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客

博客园 - 左佩玉

通过了 70-316 考试 .NET SDK 工具 线程 进程 程序配置 程序集 全局化和本地化 实现帮助 可访问性设计 访问和调用外部组件 实现打印 自定义控件 在ADO.net 中使用xml 绑定、查看和筛选数据 ADO.net 处理和抛出异常 使用Debug和Trace 测试和调试 继承 System.Collections.CollectionBase 创建一个强类型集合类
使用 GDI+
左佩玉 · 2005-08-24 · via 博客园 - 左佩玉

System.Drawing                主命名空间
System.Drawing.Design     扩展设计时用户接口的类
System.Drawing.2D          高级可视效果的类
System.Drawing.Imaging   高级图像文件操作的类
System.Drawing.Printing   打印功能
System.Drawing.Text       字体操作

Graphics对象
System.Drawing.Graphics myGraphics;
myGraphics = myForm.CreateGraphics();

Bitmap myImage = new Bitmap("C:\\myImage.bmp");
myGraphics =  Graphics.FromImage(myImage);

坐标  System.Drawing
Point
PointF
Size
SizeF
Rectangle
RectangleF

例:矩形
Point myOrigin = new Point(10,10);//起始点
Size mySize = new Size(20,20);
Rectangle myRect = new Rectangle(myOrigin,mySize);

绘图形状
DrawArc          弧
DrawBezier       贝塞尔
DrawBeziers      一系列贝塞尔样条
DrawClosedCurve  闭合曲线
DrawCurve        开放曲线
DrawEllipse      椭圆
DrawLine         线
DrawLines        一系列线条
DrawPath         复杂形状的路径对象
DrawPie          扇形
DrawPolygon      多边形
DrawRectangle    矩形
DrawRectangles   一系列矩形


实心形状
FillClosedCurve  实心闭合曲线
FillEllipse      实心椭圆
FillPath         复杂实心
FillPie          实心扇形
FillPolygon      实心多边形
FillRectangle    实心矩形
FillRectangles   一系列实心矩形
FillRegion       实心复杂形状

颜色
Color.FromArgb(Red,Green,Blue,Alpha)   Alpha可以省略
或已定义颜色
  Color.Tomato;
  SystemColors.HighlightText;

画笔
System.Drawing.SolidBrush                       单色画笔
System.Drawing.Texture                          图像填充画笔
System.Drawing.Drawing2D.HatchBrush             阴影模式
System.Drawing.Drawing2D.LinearGradientBrush    渐变
System.Drawing.Drawing2D.PathGradientBrush      复杂渐变

笔,用来绘制线
Pen myPen=new Pen(Color.Lime,4);

new Pen(myBrush);

复杂形状
GraphicsPath myPath = new Drawing2D.GraphicsPath();

new GraphicsPath(new Point[] {new Point(1,1),new Point(32,54),new Point(33,5)},
       new byte[] {(byte)PathPointType.Start,(byte)PathPointType.Line,(byte)PathPointType.Bezier});

将图形添加到路径 Addxxx
myPath.StartFigure();
//添加
myPath.CloseFigure();