使用 GDI+

 

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();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值