Chapter 5 Basic Drawing 第五章 绘图基础 — Drawing Filled Areas - 绘制已填充的区域[1]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 lzumcj_pa18 的 blog

ps:您可以转载,但请注明出处;你可以修改,但请将修改结果告诉我。
 

绘制已填充的区域
 
the next step up from drawing lines is filling enclosed areas. windows' seven functions for drawing filled areas with borders are listed in the table below.
绘制完线的下一步是填充封闭的区域。windows 的七个用于绘制有边界的已填充区域的函数在下表中列出。

function figure
rectangle
rectangle with square corners
直角矩形
ellipse
ellipse
椭圆
roundrect
rectangle with rounded corners
圆角矩形
chord
arc on the circumference of an ellipse with endpoints connected by a chord
端点由弦连接的椭圆的周围的弧
pie
pie wedge defined by the circumference of an ellipse
由椭圆的周围定义的扇形
polygon
multisided figure
多边形
polypolygon
multiple multisided figures
多个多边形
windows draws the outline of the figure with the current pen selected in the device context. the current background mode, background color, and drawing mode are all used for this outline, just as if windows were drawing a line. everything we learned about lines also applies to the borders around these figures.
windows 用选进关联设备的当前画笔绘制图形的轮廓。当前背景模式,背景颜色和绘制模式都用于这个轮廓,正如 windows 绘制线。我们学到的关于线的所有东西也适用于这些图形周围的边框。
 
the figure is filled with the current brush selected in the device context. by default, this is the stock object called white_brush, which means that the interior will be drawn as white. windows defines six stock brushes: white_brush, ltgray_brush, gray_brush, dkgray_brush, black_brush, and null_brush (or hollow_brush). you can select one of the stock brushes into the device context the same way you select a stock pen. windows defines hbrush to be a handle to a brush, so you can first define a variable for the brush handle:
图形由当前选进关联设备的画刷填充。缺省情况下,这是一个叫做 white_brush 的备用对象,这意味着内部对象将被绘制为白色。windows 定义了六个备用对象:white_bruch,ltgray_brush,gray_brush,dkgray_brush,black_brush 和 null_brush(或 hollow_brush)。你可以和你选择备用画笔一样选择这些被用画刷之一进入关联设备。windows 定义 hbrush 为画刷的句柄,因此你可以首先定义一个画刷句柄的变量:
 
hbrush hbrush ;
 
you can get the handle to the gray_brush by calling getstockobject:
你可以通过调用 getstrockobject 获得 gray_brush 的句柄:
 
hbrush = getstockobject (gray_brush) ;
 
you can select it into the device context by calling selectobject:
你可以通过调用 selectobject 选择它进关联设备:
 
selectobject (hdc, hbrush) ;
 
now when you draw one of the figures listed above, the interior will be gray.
现在当你绘制上面列出的图形之一时,内部将是灰色的。
 
to draw a figure without a border, select the null_pen into the device context:
为了绘制没有边框的图形,选择 null_pen 进关联设备:

本文关键:Chapter 5 Basic Drawing 第五章 绘图基础 — Drawing Filled Areas - 绘制已填充的区域
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top