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. Drawing on a static control.

Drawing on a static control.

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphicshelptutorial
7 Posts 4 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.
  • L Offline
    L Offline
    llp00na
    wrote on last edited by
    #1

    Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na

    C S D 3 Replies Last reply
    0
    • L llp00na

      Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Maybe this article[^] will help. It is about subclassing a CButton but the procedure is the same (AFAIK) for a static control.


      Cédric Moonen Software developer
      Charting control

      L 1 Reply Last reply
      0
      • L llp00na

        Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na

        S Offline
        S Offline
        sujtha
        wrote on last edited by
        #3

        Hi, Declare the member variable for that static control. ex: if the subclass for static is cmystatic initialize the variable in dlg cDlg.h #include "mystatic.h" CMystatic stat; //Cdlg.cpp void CDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFirstDlg) DDX_Control(pDX, IDC_STATIC_FIRST, m_fir); //}}AFX_DATA_MAP }

        L 1 Reply Last reply
        0
        • L llp00na

          Hi, How do I use a static control to draw on a dialog ? So far, I have created a static text control and added a member control variable to it of type CStatic. Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that. Any help will be highly appreciated. llp00na

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          llp00na wrote:

          Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that.

          Use ClassWizard (Ctrl+W) to derive a new class from CStatic. Then you can override its OnPaint() method.


          "The largest fire starts but with the smallest spark." - David Crow

          "Judge not by the eye but by the heart." - Native American Proverb

          L 1 Reply Last reply
          0
          • D David Crow

            llp00na wrote:

            Now, I am required to subclass the text control so that i can override its OnPaint() function but i do not know how to achieve that.

            Use ClassWizard (Ctrl+W) to derive a new class from CStatic. Then you can override its OnPaint() method.


            "The largest fire starts but with the smallest spark." - David Crow

            "Judge not by the eye but by the heart." - Native American Proverb

            L Offline
            L Offline
            llp00na
            wrote on last edited by
            #5

            thank you. I am done now :) llp00na

            1 Reply Last reply
            0
            • C Cedric Moonen

              Maybe this article[^] will help. It is about subclassing a CButton but the procedure is the same (AFAIK) for a static control.


              Cédric Moonen Software developer
              Charting control

              L Offline
              L Offline
              llp00na
              wrote on last edited by
              #6

              thanx for the gr8 article llp00na

              1 Reply Last reply
              0
              • S sujtha

                Hi, Declare the member variable for that static control. ex: if the subclass for static is cmystatic initialize the variable in dlg cDlg.h #include "mystatic.h" CMystatic stat; //Cdlg.cpp void CDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFirstDlg) DDX_Control(pDX, IDC_STATIC_FIRST, m_fir); //}}AFX_DATA_MAP }

                L Offline
                L Offline
                llp00na
                wrote on last edited by
                #7

                thanx, i am done now. I used the class wizard as david suggested llp00na

                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