Setting the Pen or Brush Color
2013-05-08 07:54
295 查看
Setting the Pen or Brush Color The following example shows how an application can change the DC pen color by using the GetStockObject function or SetDCPenColor and the SetDCBrushColor functions. HGDIOBJ original = NULL; //Save original object. original = SelectObject(hdc,GetStockObject(DC_PEN)); //Change the DC pen color SetDCPenColor(hdc,RGB(0x00,0xff,0x00)); Rectangle(0,0,20,20); SetDCPenColor(hdc,RGB(0x00,0x00,0xff)); Rectangle(0,0,20,20); // The brush color can be changed in a similar manner. SetDCPenColor // and SetDCBrushColor can be used interchangeably with GetStockObject // to change the current color. SelectObject(hDC,GetStockObject(DC_BRUSH)); SetDCBrushColor(hDC,RGB(0x00,0x00,0x00)); // Provides the same flexibility as: SelectObject(hDC,GetStockObject(BLACK_BRUSH)); //Restore original object. SelectObject(hDc,original); // It is not necessary to call DeleteObject to delete stock objects.
相关文章推荐
- Error message when you try to install a SQL Server 2005 service pack or a SQL Server 2005 hotfix package: "Error 29528. The setup has encountered an unexpected error while Setting Internal Properties"
- 新建winform项目,在其中拖入2个button和1个 PictureBox,1Openfiledialog用Graphics\pen\brush\color\Font\的属性画出不同图案
- HDU - 1556 Color the ball(树状数组 or 线段树)
- You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
- 新建winform项目,在其中拖入2个button和1个 PictureBox,1Openfiledialog用Graphics\pen\brush\color\Font\的属性画出不同图案 .
- 新建winform项目,在其中拖入2个button和1个 PictureBox,1Openfiledialog。使用Graphics\pen\brush\color\Font\等类和对应的方法属性
- The setting for the Platform Builder global WINCEROOT is missing or invalid
- 使用Graphics\pen\brush\color\Font\等类和对应的方法属性
- Dynamically Setting the Page's Title in ASP.NET 2.0 or By SiteMap
- 使用Graphics、pen、brush、color、Font类和对应的方法属性
- BASH Shell change the color of my shell prompt under Linux or UNIX
- WinSCP:but error occurred while setting the permissions and/or timestamp
- svnant的BUILD FAILED Problem: failed to create task or type svnSetting Cause: The name is undefined原因
- hdu 1556 Color the ball(线段树 or 树状数组 or 前缀和)
- Setting the background color and background alpha on a Flex PopUpButton control’s pop up menu
- You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- 警告 Setting the background color on UITableViewHeaderFooterView has been deprecated
- Setting the background color on UITableViewHeaderFooterView has been deprecated. Please use contentV
- [Programming Visual C++]Chapter Six-Setting the Color for the Dialog Background and for Controls