how to draw a button on a image RRS feed

  • Question

  • first, create a button via

    CreateWindow(WC_BUTTON, ...)
    second, draw a image via StretchDIBits(hdc, x, ...), the image memory is gotten with a camera
    then, I want to draw the button created above on the image
    I try to use ShowWindow, it will send a message to windows to draw the button
    so ShowWindow and StretchDIBits maybe be draw button first, then draw image, or draw image first, then draw button
    it's not what I want to do. I want to draw image first, then draw button immediately. Or the button is covered by the image.
    Monday, October 21, 2019 1:41 PM

All replies

  • Hello,

    please provide more information how you call the functions.

    I suggest, you could create the button without drawing in Init-Routine.

    Evertime you draw the window in OnPaint() you first draw the image and then draw the button on top of the z-order with SetWindowPos.

    Regards, Guido

    Monday, October 21, 2019 1:56 PM
  • Try setting WS_CLIPCHILDREN style on the parent dialog/window of your button.


    Monday, October 21, 2019 3:41 PM