Click here to Skip to main content
15,609,332 members
Articles / Desktop Programming / MFC
Posted 27 Aug 2003


30 bookmarked

A Cool GDI Pattern Brush Tool with C++ Source Code

Rate me:
Please Sign up or sign in to vote.
3.32/5 (31 votes)
27 Aug 2003
A cool GDI pattern brush tool with C++ source code. You can create a new office XP style pattern fill mode quickly.

Image 1


This article shows how to use a pattern brush to give your application a similar look and feel, and it also includes a pattern brush bits tool. With this tool, you can create a new style of pattern brush very quickly.

How to Use It

The steps for usage are as follows:

  • Run application brushtool.exe.
  • Click on the left design panel to draw a style, you can click >> button to preview the style.
  • Click copy button to copy the bits to clipboard.
  • Call the following code to use the pattern brush. (You can paste the brush bits to the red field.)


WORD m_bitsBrush1[8] = { 0xee,0xed,0xeb,0xe7,0xef,0xff,0xff,0xff };

CBrush brush,*pOldbrush;
CBitmap bm;

LOGBRUSH logBrush;
logBrush.lbStyle = BS_PATTERN;
logBrush.lbHatch = (int) bm.GetSafeHandle();
logBrush.lbColor = RGB(0,0,0);

int savedc = dc.SaveDC();


This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.

Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralColor and Transparency Pin
foufou27-Apr-08 0:11
foufou27-Apr-08 0:11 
GeneralReally a nice article Pin
Sarath C21-May-06 19:28
Sarath C21-May-06 19:28 
GeneralRe: Really a nice article Pin
joyjjjz25-Sep-08 17:20
joyjjjz25-Sep-08 17:20 
GeneralA little imagination goes a long way!! Pin
WREY29-Aug-03 16:51
WREY29-Aug-03 16:51 
GeneralUsability suggestion Pin
YoSilver28-Aug-03 23:05
YoSilver28-Aug-03 23:05 
GeneralRe: Usability suggestion Pin
ucc80129-Aug-03 0:09
ucc80129-Aug-03 0:09 
GeneralGreat tool! Pin
Anonymous28-Aug-03 4:03
Anonymous28-Aug-03 4:03 
GeneralRe: Great tool! Pin
Warren Stevens28-Aug-03 7:13
Warren Stevens28-Aug-03 7:13 
GeneralAnonymous = comment by author Pin
dog_spawn28-Aug-03 14:58
dog_spawn28-Aug-03 14:58 
GeneralRe: Anonymous = comment by author Pin
.dan.g.28-Aug-03 17:24
professional.dan.g.28-Aug-03 17:24 
Generalheh Pin
dog_spawn28-Aug-03 18:52
dog_spawn28-Aug-03 18:52 
GeneralRe: heh Pin
Ernest Laurentin29-Aug-03 4:10
Ernest Laurentin29-Aug-03 4:10 
GeneralSuggestion Pin
dog_spawn28-Aug-03 3:45
dog_spawn28-Aug-03 3:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.