您的位置:首页 > 编程语言

GDI+编程基础(1)

2009-12-11 20:12 204 查看
从GDI+所包含的内容来看,它主要由以下几方面构成:

二维几何图形的处理 

    矢量图形由图元(如直线、曲线和轮廓等)组成,图元由坐标中的一组点来制定。GDI+的Rectangele类用于存储一个矩形的位置和尺寸;Pen类存储了线条颜色、线宽和线条风格的信息;Graphics类拥有用于绘制直线、矩形及其他图形的方法;还有几个Brush类存储了怎么用颜色来填充闭合图形和路径。

 

显示图像

    用于存储位图信息的数据结构比用于存储矢量图形所要求的数据结构更为复杂。所以,在GDI+中就有几个类用于处理这些复杂的位图信息。

 

排版

    排版与使用各种各样的字体、尺寸和风格显示的文本有关。GDI+为一复杂的任务提供了大量的函数来完善各种不同的风格的文本输出。

 

To create a graphics object

Receive a reference to a graphics object as part of the PaintEventArgs in the Paint event of a form or control. This is usually how you obtain a reference to a graphics object when creating painting code for a control.

-or-

Call the CreateGraphics method of a control or form to obtain a reference to a Graphics object that represents the drawing surface of that control or form. Use this method if you want to draw on a form or control that already exists.

-or-

Create a Graphics object from any object that inherits from Image. This approach is useful when you want to alter an already existing image.

The following sections give details about each of these processes.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息