Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help: GDI functions not working in OnInitDialog

Help: GDI functions not working in OnInitDialog

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Ebert
    wrote on last edited by
    #1

    I have some code that includes a function that draws a simple graph in a CButton using GDI calls (FillRectangle and Polyline). The purpose of this code is to allow selection of foreground and background colors. The "graph" in the CButton shows what the selection(s) will look like. I call the function in question when one of the color buttons is pushed and it works fine in those instances. So, I placed calls to the function in OnInitDialog (after the CDialog::OnInitDialog call), but it does not do the drawing. I've walked thru the code and it all appears to be executing correctly, but the graph is not displayed. Any ideas? Thanks, so much.

    B R 2 Replies Last reply
    0
    • P Paul Ebert

      I have some code that includes a function that draws a simple graph in a CButton using GDI calls (FillRectangle and Polyline). The purpose of this code is to allow selection of foreground and background colors. The "graph" in the CButton shows what the selection(s) will look like. I call the function in question when one of the color buttons is pushed and it works fine in those instances. So, I placed calls to the function in OnInitDialog (after the CDialog::OnInitDialog call), but it does not do the drawing. I've walked thru the code and it all appears to be executing correctly, but the graph is not displayed. Any ideas? Thanks, so much.

      B Offline
      B Offline
      Blake Miller
      wrote on last edited by
      #2

      Try initiating a redraw on it with an Invalidate. Windows might not be thinking it needs to paint the control, or your MFC DC for the dialog is not valid yet. At least after the dialog is inited, there will be a paint message in the queue for that control to execute the drawing.

      1 Reply Last reply
      0
      • P Paul Ebert

        I have some code that includes a function that draws a simple graph in a CButton using GDI calls (FillRectangle and Polyline). The purpose of this code is to allow selection of foreground and background colors. The "graph" in the CButton shows what the selection(s) will look like. I call the function in question when one of the color buttons is pushed and it works fine in those instances. So, I placed calls to the function in OnInitDialog (after the CDialog::OnInitDialog call), but it does not do the drawing. I've walked thru the code and it all appears to be executing correctly, but the graph is not displayed. Any ideas? Thanks, so much.

        R Offline
        R Offline
        Robin
        wrote on last edited by
        #3

        try looking at OnCtlCOlor Function AFter InitDialog it would call this function which does the painting of all dialog controls and the dialog RObin

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups