Path: 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 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 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=