Announcement

Collapse
No announcement yet.

Drawing on a BMP Image

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Drawing on a BMP Image

    I have a BMP of a world map that I display using CONTROL ADD IMAGE, then I want to draw graphics (Satellite orbital paths) on top of it but have been unable to do this. Can this be done?
    Brent Boshart

  • #2
    First, you should only draw graphics during a %WM_PAINT event. To force the repaint you simply invalidate the rectange using InvalidateRect() and then call UpdateWindow(). This should cause your %WM_PAINT event code to almost immediately trigger and you can draw your graphics.

    You may need to experiment a little to ensure that your painting code occurs after the real image is displayed. For this, you'll probably need to subclass the control so you can work with the %WM_PAINT event of the IMAGEX control rather than the %WM_PAINT event of the dialog. If you use the "private" %WM_PAINT event of the controls, you'll have to let the default handler do the drawing initial drawing (which will display the BMP image), before doing your own drawing over the top.

    Personally, I'd use a grayframe (LABEL) control and handle all aspects of the drawing myself, including drawing the BMP on the control - this way I have complete control of the image, and there is no subclassing involved because it can all be handled in the %WM_PAINT event of the dialog callback.

    Clear as mud?

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X