Click here to Skip to main content
Licence 
First Posted 27 Aug 2003
Views 63,331
Bookmarked 29 times

A cool GDI pattern brush tool with C++ source code

By | 27 Aug 2003 | Article
A cool GDI pattern brush tool with C++ source code, You can create a new office xp style pattern fill mode quickly

Introduction

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)

Code

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

CBrush brush,*pOldbrush;
CBitmap bm;
bm.CreateBitmap(8,8,1,1,m_bitsBrush1);

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

brush.CreateBrushIndirect(&logBrush);
int savedc = dc.SaveDC();
pOldbrush=dc.SelectObject(&brush);
dc.SetBkMode(TRANSPARENT); 
dc.SetBkColor(RGB(255,255,255));
dc.Rectangle(&rcNew);
dc.SelectObject(pOldbrush); 
brush.DeleteObject();
bm.DeleteObject();
dc.RestoreDC(savedc);

License

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

About the Author

ucc801



China China

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralColor and Transparency Pinmemberfoufou0:11 27 Apr '08  
GeneralReally a nice article PinmemberSaRath 19:28 21 May '06  
GeneralRe: Really a nice article Pinmemberjoyjjjz17:20 25 Sep '08  
GeneralA little imagination goes a long way!! PinmemberWREY16:51 29 Aug '03  
GeneralUsability suggestion PinmemberYoSilver23:05 28 Aug '03  
GeneralRe: Usability suggestion Pinmemberucc8010:09 29 Aug '03  
GeneralGreat tool! PinsussAnonymous4:03 28 Aug '03  
GeneralRe: Great tool! PinmemberWarren Stevens7:13 28 Aug '03  
GeneralAnonymous = comment by author Pinmemberdog_spawn14:58 28 Aug '03  
GeneralRe: Anonymous = comment by author Pinmemberdang!17:24 28 Aug '03  
Generalheh Pinmemberdog_spawn18:52 28 Aug '03  
GeneralRe: heh PinmemberErnest Laurentin4:10 29 Aug '03  
GeneralSuggestion Pinmemberdog_spawn3:45 28 Aug '03  

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

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 28 Aug 2003
Article Copyright 2003 by ucc801
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid