Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing simple shapes in a dialog box control???

Status
Not open for further replies.

nexius

Programmer
Jul 8, 2000
109
CA
Hi

I'm trying to figure out how to use CPen, CBrush, etc in a dialog box control like say, a picture or a static text object.

Is this even possible?

I can draw it on the dialog box itself but I'd like to restrict it to a certain part of it.

Any help appreciated
 
You'd need to subclass the control you're using to draw in and override its [tt]Paint[/tt] method.

[tt]________________________________________________________________
[pc2]Roger
Life is a game of cards in which the deck contains only jokers.[/tt]
 
Alright I figured it out...

I used something along these lines for anyone that maybe searched and found this thread:

CPaintDC dc(this);
CRect rect(5,10,150,170);
CBrush brush(COLORREF(0x0000BBBB));

CWnd *lpStaticWnd;
CRect static_rect;
lpStaticWnd = GetDlgItem(IDC_STATIC1);
lpStaticWnd -> GetWindowRect(&static_rect);
ScreenToClient(&static_rect);
dc.IntersectClipRect(&static_rect);
dc.FillRect(&rect,&brush);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top