Click here to Skip to main content
12,453,183 members (63,494 online)
Click here to Skip to main content
Add your own
alternative version

Stats

74.4K views
2.4K downloads
30 bookmarked
Posted

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

, 27 Aug 2003
Rate this:
Please Sign up or sign in to vote.
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

Share

About the Author

ucc801
China China
No Biography provided

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralColor and Transparency Pin
foufou27-Apr-08 0:11
memberfoufou27-Apr-08 0:11 
GeneralReally a nice article Pin
SaRath 21-May-06 19:28
memberSaRath 21-May-06 19:28 
GeneralRe: Really a nice article Pin
joyjjjz25-Sep-08 17:20
memberjoyjjjz25-Sep-08 17:20 
GeneralA little imagination goes a long way!! Pin
WREY29-Aug-03 16:51
memberWREY29-Aug-03 16:51 
GeneralUsability suggestion Pin
YoSilver28-Aug-03 23:05
memberYoSilver28-Aug-03 23:05 
GeneralRe: Usability suggestion Pin
ucc80129-Aug-03 0:09
memberucc80129-Aug-03 0:09 
GeneralGreat tool! Pin
Anonymous28-Aug-03 4:03
sussAnonymous28-Aug-03 4:03 
GeneralRe: Great tool! Pin
Warren Stevens28-Aug-03 7:13
memberWarren Stevens28-Aug-03 7:13 
GeneralAnonymous = comment by author Pin
dog_spawn28-Aug-03 14:58
memberdog_spawn28-Aug-03 14:58 
GeneralRe: Anonymous = comment by author Pin
dang!28-Aug-03 17:24
memberdang!28-Aug-03 17:24 
Generalheh Pin
dog_spawn28-Aug-03 18:52
memberdog_spawn28-Aug-03 18:52 
GeneralRe: heh Pin
Ernest Laurentin29-Aug-03 4:10
memberErnest Laurentin29-Aug-03 4:10 
GeneralSuggestion Pin
dog_spawn28-Aug-03 3:45
memberdog_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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 28 Aug 2003
Article Copyright 2003 by ucc801
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid