NULL_PEN、 NULL_BRUSH 和 HOLLOW_BRUSH 的使用
来源:互联网 发布:淘宝代销上架宝贝图片 编辑:程序博客网 时间:2024/06/05 11:50
NULL_PEN、 NULL_BRUSH 和 HOLLOW_BRUSH 的使用
Use of NULL_PEN, NULL_BRUSH, and HOLLOW_BRUSH
http://support.microsoft.com/kb/66532/en-us/
GDI contains several "NULL" stock objects: NULL_BRUSH, HOLLOW_BRUSH, and NULL_PEN. These objects are defined in WINDOWS.H (16-bit SDK) or in WINGDI.H (32-bit SDK). These header files define HOLLOW_BRUSH as NULL_BRUSH, so they are the same objects.
Note that NULL_BRUSH and NULL_PEN are NOT identical to the value NULL. The value NULL is defined as 0 (zero) in WINDOWS.H and is not a valid stock object.
Many GDI functions use the current brush to fill interiors and the current pen to draw lines. In some cases, an application may not want to modify the areas normally affected by the pen or brush. Selecting a NULL_PEN or NULL_BRUSH into the device context tells GDI not to modify the normally affected areas. In short, "NULL_" objects do not draw anything.
For example, the Rectangle() function uses the current brush to fill the interior of the rectangle and the current pen to draw the border. If NULL_PEN is selected into the device context, no border is drawn. If NULL_BRUSH or HOLLOW_BRUSH is selected, the interior of the rectangle is not painted. If both NULL_PEN and NULL_BRUSH are selected, the rectangle will not be drawn.原文翻译请注意 NULL_BRUSH 和 NULL_PEN 不为 NULL 的值相同。值为 NULL 被定义在 WINDOWS.H 中为 0 (零) 他们并不是有效的常用对象。
许多 GDI 函数使用当前画笔填充内部和当前笔来绘制直线。在某些情况下,应用程序可能不需要修改通常由钢笔或画笔受影响的区域。选择到设备上下文的 NULL_PEN 或 NULL_BRUSH 通知 GDI 不能修改通常受影响的区域。简单地说,"NULL_"的对象不显示任何内容。
例如,Rectangle() 函数使用当前画笔填充矩形和当前笔来绘制边框的内部。如果 NULL_PEN 被选入设备上下文中,不加边框。如果选择 NULL_BRUSH 或 HOLLOW_BRUSH,则不绘制的矩形的内部。如果选择了 NULL_PEN 和 NULL_BRUSH,将不绘制矩形。
NULL_PEN的作用:事实上这个有时候很有用,比如你要画一个不带边框的红色圆形,那么你可以选入一个红色的画刷,然后使用NULL_PEN来画。
CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
NULL_BRUSH是一个宏,表示空画刷,在这里等同于HOLLOW_BRUSH,两个可以通用。HOLLOW,中文意思即为“空”。所以,这句代码,是创建了一个画刷类(CBrush)的指针变量,并在定义之时,为其创建了一个空画刷。通常,可以在为静态文本控件、编辑框控件、按钮控件等控件设置透明时,使用这句代码。
Use of NULL_PEN, NULL_BRUSH, and HOLLOW_BRUSH
GDI contains several "NULL" stock objects: NULL_BRUSH, HOLLOW_BRUSH, and NULL_PEN. These objects are defined in WINDOWS.H (16-bit SDK) or in WINGDI.H (32-bit SDK). These header files define HOLLOW_BRUSH as NULL_BRUSH, so they are the same objects.
Note that NULL_BRUSH and NULL_PEN are NOT identical to the value NULL. The value NULL is defined as 0 (zero) in WINDOWS.H and is not a valid stock object.
Many GDI functions use the current brush to fill interiors and the current pen to draw lines. In some cases, an application may not want to modify the areas normally affected by the pen or brush. Selecting a NULL_PEN or NULL_BRUSH into the device context tells GDI not to modify the normally affected areas. In short, "NULL_" objects do not draw anything.
For example, the Rectangle() function uses the current brush to fill the interior of the rectangle and the current pen to draw the border. If NULL_PEN is selected into the device context, no border is drawn. If NULL_BRUSH or HOLLOW_BRUSH is selected, the interior of the rectangle is not painted. If both NULL_PEN and NULL_BRUSH are selected, the rectangle will not be drawn.
许多 GDI 函数使用当前画笔填充内部和当前笔来绘制直线。在某些情况下,应用程序可能不需要修改通常由钢笔或画笔受影响的区域。选择到设备上下文的 NULL_PEN 或 NULL_BRUSH 通知 GDI 不能修改通常受影响的区域。简单地说,"NULL_"的对象不显示任何内容。
例如,Rectangle() 函数使用当前画笔填充矩形和当前笔来绘制边框的内部。如果 NULL_PEN 被选入设备上下文中,不加边框。如果选择 NULL_BRUSH 或 HOLLOW_BRUSH,则不绘制的矩形的内部。如果选择了 NULL_PEN 和 NULL_BRUSH,将不绘制矩形。
NULL_PEN的作用:事实上这个有时候很有用,比如你要画一个不带边框的红色圆形,那么你可以选入一个红色的画刷,然后使用NULL_PEN来画。
CBrush *pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
NULL_BRUSH是一个宏,表示空画刷,在这里等同于HOLLOW_BRUSH,两个可以通用。HOLLOW,中文意思即为“空”。所以,这句代码,是创建了一个画刷类(CBrush)的指针变量,并在定义之时,为其创建了一个空画刷。通常,可以在为静态文本控件、编辑框控件、按钮控件等控件设置透明时,使用这句代码。
- NULL_PEN、 NULL_BRUSH 和 HOLLOW_BRUSH 的使用
- VC++中的NULL_PEN和NULL_BRUSH
- NULL_BRUSH 或HOLLOW_BRUSH和GetStockObject函数
- int?和??的使用
- ”##“ 和 "#" 的使用
- “$this->”和”::”的使用
- &和&&的使用区别
- Swift -- !和?的使用
- UIPickView的使用和
- Mybatis - # 和 $ 的使用
- C# ?和??的使用
- .和:的使用情况
- ExpandableListActivity的使用和SimpleExpandableListAdapter的使用
- Collector的使用和MultiReader的使用
- 使用简单的DepthBuffer 和使用Lights
- 使用velocity :$velocityCount和Tool的使用
- openocd的使用和minicom简单使用
- 使用枚举和使用宏的区别
- 分享常用JDBC连接参数
- linux 内核中断源码分析
- 从服务器取图片
- Domino中的相关CGI域和变量详解
- POJ1003 hangover
- NULL_PEN、 NULL_BRUSH 和 HOLLOW_BRUSH 的使用
- C++ 虚函数表解析 .
- DB2库内load custor性能测试
- Java常用类库——正则表达式
- 从RTC设备学习中断
- JMX术语
- Linux内核源码树学习:Kconfig和Makefile
- 从文本框输入看软件的健壮性
- IBATIS的sqlmap中特殊字符导致导出的execl打开出错问题的一点研究