Click to See Complete Forum and Search --> : I just want to draw simple shapes in a dialog!


gstokes
May 7th, 1999, 11:48 AM
Hi.

I have a static bitmap in a dialog control, and I want to highlight various areas of it with color as the user presses keys.

I have all the logic implemented, but I can't get the redrawing to work properly. Inside Visual C++ claims that you just override OnPaint and do your stuff, but then only the one control I'm messing with gets drawn. Any invalidation of the rest of the dialog makes it go blank.

How can I draw inside a dialog control and have the changes stick?

Thanks.

May 11th, 1999, 10:45 AM
Have you tried pDialog->UpdateWindow() ?

May 11th, 1999, 07:45 PM
Hi Stokes,
Override the OnPaint of the Dialog Control and not teh dialog.U will have to subclass the dialog control and then trap WM_PAINT in that control.
When the main dialog gets a WM_PAINT,it draws itself and then sendsWM_PAINT to all its children.So if u do ur painting in the handler for WM_PAINT for the child control,then ur visual changes will stick...
-Raj(MohanR@bsci.com)

gstokes
May 12th, 1999, 11:56 AM
Thanks to those who responded.

I didn't want to subclass anything to make a new control, so I created an owner-draw button in the dialog. When I want to change it, I call its RedrawWindow method. This in turn calls the parent window's OnDrawItem with the control's ID. I then have a routine in the parent window draw the button as I see fit.