
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.