.NET 2.0的绘图功能

本文介绍了.NET2.0中System.Drawing命名空间提供的绘图功能,包括使用Graphics类进行绘制操作,Pen类用于绘制直线和曲线,Brush类用于填充形状内部,以及Bitmap类的多种构造函数用于创建和处理位图。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml">

                             .NET 2.0的绘图功能


System.Drawing

提供对GDI+基本图形功能访问。

更高级的功能在System.Drawing.Drawing2DSystem.Drawing.ImagingSystem.Drawing.Text命名空间提供。

Graphics类提供了绘制到显示设备的方法。诸如RectanglePoint等类可封装GDI+基元。

Pen类用于绘制直线和曲线。

从抽象类Brush派生出了的类则用于填充形状的内部。

Bitmap 封装GDI+位图,此位图由图形图像及属性的像素组成,用于处理由像素数据定义的图像对象。

语法:

[SerializableAttribute]

[ComVisibleAttribute(true)]

Public sealed class Bitmap:Image

Bitmap成员

公共构造函数

Bitmap   已重载     初始化Bitmap类的新实例

BitmapImage original

Bitmapstring fileName

BitmapSystem.IO.Stream stream)

BitmapImage originalSize newSize

Bitmapint widthint height

Bitmapstring filename,bool Icm)

BitmapSystem.IO.Stream streambool useIcm

BitmapType typestring resource

BitmapImage originalint widthint height

Bitmapint widthint heightGraphics g

Bitmapint widthint heightSystem.Drawing.Imaging.PixelFormat format)

Bitmapint widthint heightSystem.Drawing.Imaging.PixelFormat format)

 

使用Bitmapint widthint height)自己绘制一个图像

Graphics g;

Bitmap bm=new Bitmap400400;

g=Graphics.FromImage(bm);

g.DrawLinePens.Red,0,0,400,400;

g.DrawLinePens.Red,0,400,400,0);

使用已有的图像

Bitmap bm=new Bitmap(“Images//boy.jpg”);

路径分隔符

相对目录:Images//boy.jpg

          ..//..//Images//boy.jpg  ..表示返回上一级目录

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值