Home | Products | Download | Purchase | Support 


XD++ Library
Features Tour What's New
Download Area
Purchase
License agreement
General Q & A
 
UCCDraw ActiveX
Features Tour
Download Area
Purchase
DocVizor
Features Tour
Why need DocVizor
Screen Shots
Download Area
Purchase
TFC Library
Features Tour
Screen Shots
Download Area
Purchase
Free Products
A Cool Year selector
Project backup tool
Rename project tool
Replace all in files tool
A cool color picker
Technical Support
General Q & A
Report A Bug
Suggestions
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET

   

A cool GDI pattern brush tool with C++ source code
--
CBrush, LOGBRUSH, CreateBrushIndiect


Free Products List:

Author homepage:
UCanCode Software (www.ucancode.net)

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);
 


[ Home | Products | Download Area | Purchase | SupportContact us ]


Copyright ?1998-2024 UCanCode.Net Software, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net