Article View: comp.windows.ms
Article #13900Re: drawing inside dialog box
From: Nick Jurascheck <JurascheckNH>
Date: Mon, 08 Jan 1990 17:44
Date: Mon, 08 Jan 1990 17:44
30 lines
1572 bytes
1572 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:
<926@roo.cs.bham.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!ukc!kl-cs!nott-cs!roo.cs.bham.ac.uk!nhjReferences:
<89122504121422@masnet.uucp>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!mcsun!ukc!kl-cs!nott-cs!roo.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: <926@roo.cs.bham.ac.uk> Date: 8 Jan 90 17:44:25 GMT References: <89122504121422@masnet.uucp> Reply-To: nhj@roo.UUCP (Nick Jurascheck <JurascheckNH>) Organization: University of Birmingham, England Lines: 30