🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms
Article #13864

Re: drawing inside dialog boxes

#13864
From: Marco Papa
Date: Wed, 20 Dec 1989 18:05
30 lines
1476 bytes
In article <33325@ucbvax.BERKELEY.EDU> kipnis@janus.Berkeley.EDU (Gary Kipnis) writes:
>Hi, is it possible to draw inside a dialog box, i.e. I want to draw a 
>blue rectangle inside a dialog box and change its color according to dialog
>commands, but for some reason every time I try to draw it I get nothing,
>here is what I do:
>case WM_INITDIALOG:
>    hDC = GetDC(hDlg);
>    .
>    .
>
>    Rectangle(hDC, x1, y1, x2, y2);
>

Sure.  A full example is on p. 429-433 of Programming Windows, by C. Petzold.
The sequence he uses goes like this:

hDC = GetDC(hWnd);
GetClientRect (hWnd, &rect);
hBrush = CreateSolidBrish(...);
hBrush = SelectObject(hDC, hBrush);
Rectangle(hDC, rect.left, ...);
DeleteObject(SelectObject(hDC, hBrush));
ReleaseDC(hWnd, hFC);

-- Marco


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Xerox sues somebody for copying?" -- David Letterman
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <21888@usc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!usc!pollux.usc.edu!papa
References: <33325@ucbvax.BERKELEY.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!usc!pollux.usc.edu!papa
From: papa@pollux.usc.edu (Marco Papa)
Newsgroups: comp.windows.ms
Subject: Re: drawing inside dialog boxes
Message-ID: <21888@usc.edu>
Date: 20 Dec 89 18:05:31 GMT
References: <33325@ucbvax.BERKELEY.EDU>
Sender: news@usc.edu
Reply-To: papa@pollux.usc.edu (Marco Papa)
Organization: Felsina Software, Los Angeles, CA
Lines: 30