CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Location
    Chicago
    Posts
    40

    I just want to draw simple shapes in a dialog!

    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.


  2. #2
    Guest

    Re: I just want to draw simple shapes in a dialog!

    Have you tried pDialog->UpdateWindow() ?


  3. #3
    Guest

    trap WM_PAINT of teh Child Control and not the dialog

    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([email protected])


  4. #4
    Join Date
    May 1999
    Location
    Chicago
    Posts
    40

    found a solution

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured