kipnis@janus.berkeley.edu@canremote.uucp (kipnis@janus.Berkeley.EDU) (12/21/89)
From: kipnis@janus.Berkeley.EDU (Gary Kipnis) Subj: drawing inside dialog boxes Orga: University of California, Berkeley 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); Thank you, gary --- * Via MaSNet/HST96/HST144/V32 - UN PC Windowing Systems * Via Usenet Newsgroup comp.windows.ms
nhj@cs.bham.ac.uk (Nick Jurascheck <JurascheckNH>) (01/09/90)
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