🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms
Article #13899

Re: drawing inside dialog box

#13899
From: Nick Jurascheck <JurascheckNH>
Date: Mon, 08 Jan 1990 16:29
30 lines
1550 bytes
In article <89122504121422@masnet.uucp>
kipnis@janus.berkeley.edu@canremote.uucp (kipnis@janus.Berkeley.EDU)
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);

Yes, if you process the WM_PAINT message instead of WM_INITDIALOG and use: 

	hDC = BeginPaint(hDlg, &ps);
	Rectangle(hDC, x1, y1, x2, y2);
	EndPaint(hDlg, &ps); 

The GetDC/ReleaseDC combination does not validate the area drawn on,
whereas BeginPaint/EndPaint does. It seems that Windows paints over
anything drawn the way you tried (with the contents of the dialog box
or even just an empty background), because it is not validated.

Nick

JANET: JurascheckNH@uk.ac.bham.cs  |  UUCP: ...!mcvax!bhamcs!JurascheckNH
BITNET: JurascheckNH%cs.bham.ac.uk@ukacrl.bitnet
INTERNET: JurascheckNH%cs.bham.ac.uk@cunyvm.cuny.edu
Technical Details
Message-ID: <925@mrs-tiggywinkle.cs.bham.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcsun!ukc!kl-cs!nott-cs!mrs-tiggywinkle.cs.bham.ac.uk!nhj
References: <89122504121422@masnet.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcsun!ukc!kl-cs!nott-cs!mrs-tiggywinkle.cs.bham.ac.uk!nhj
From: nhj@cs.bham.ac.uk (Nick Jurascheck <JurascheckNH>)
Newsgroups: comp.windows.ms
Subject: Re: drawing inside dialog box
Message-ID: <925@mrs-tiggywinkle.cs.bham.ac.uk>
Date: 8 Jan 90 16:29:53 GMT
References: <89122504121422@masnet.uucp>
Organization: Birmingham University, England
Lines: 30