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. How to get flat button in CPropertySheet(C++V6)?

How to get flat button in CPropertySheet(C++V6)?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
7 Posts 2 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
    Pierre Couderc
    wrote on last edited by
    #1

    Is there an easy way to get flat button style for standard buttons (OK, cancel...) in a CPropertySheet (in C++ V6)? Thank you in advance, Pierre Couderc Pierre Couderc www.tol.fr

    R 1 Reply Last reply
    0
    • P Pierre Couderc

      Is there an easy way to get flat button style for standard buttons (OK, cancel...) in a CPropertySheet (in C++ V6)? Thank you in advance, Pierre Couderc Pierre Couderc www.tol.fr

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      Try here[^]. A excellent comprehensive button suite.

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      P 1 Reply Last reply
      0
      • R Ryan Binns

        Try here[^]. A excellent comprehensive button suite.

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        P Offline
        P Offline
        Pierre Couderc
        wrote on last edited by
        #3

        Thank you very much : you are right that Davide Calbabro CButtonST class is excellent and I use it from years, but I do not see the relation with my problem. My question is how to get an access to OK, cancel button in a CPropertySheet to be able to work on them and pass them in flat mode? Pierre Couderc www.tol.fr

        R 1 Reply Last reply
        0
        • P Pierre Couderc

          Thank you very much : you are right that Davide Calbabro CButtonST class is excellent and I use it from years, but I do not see the relation with my problem. My question is how to get an access to OK, cancel button in a CPropertySheet to be able to work on them and pass them in flat mode? Pierre Couderc www.tol.fr

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          Oops. I missed the word "standard" in your post :-O sorry! As for those buttons, the only way I can think of is to subclass the buttons with one of the CButtonST buttons. I'm not sure exactly how the class works (I've never used it myself), but I'm fairly sure it would do the job. Try something like this:

          CButtonST button;
          button.SubclassDlgItem(IDOK, this);

          in your property sheet - in the WM_CREATE message handler or something similar. You might have to use EnumChildWindows() to search for the button with the "OK" text if it doesn't have the ID IDOK. Similarly for the cancel button. Hope this helps,

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          P 1 Reply Last reply
          0
          • R Ryan Binns

            Oops. I missed the word "standard" in your post :-O sorry! As for those buttons, the only way I can think of is to subclass the buttons with one of the CButtonST buttons. I'm not sure exactly how the class works (I've never used it myself), but I'm fairly sure it would do the job. Try something like this:

            CButtonST button;
            button.SubclassDlgItem(IDOK, this);

            in your property sheet - in the WM_CREATE message handler or something similar. You might have to use EnumChildWindows() to search for the button with the "OK" text if it doesn't have the ID IDOK. Similarly for the cancel button. Hope this helps,

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            P Offline
            P Offline
            Pierre Couderc
            wrote on last edited by
            #5

            Thank you for your ideas. I have tried to override OnInitDialog() but it does not work : BOOL CMyPropertySheet::OnInitDialog() { BOOL Stat= CPropertySheet::OnInitDialog(); CButton* pButton = (CButton*) this->GetDlgItem(IDCANCEL); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } pButton = (CButton*) this->GetDlgItem(IDOK); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } pButton = (CButton*) this->GetDlgItem(IDCLOSE); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } pButton = (CButton*) this->GetDlgItem(ID_APPLY_NOW); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } return Stat; } Pierre Couderc www.tol.fr

            R 1 Reply Last reply
            0
            • P Pierre Couderc

              Thank you for your ideas. I have tried to override OnInitDialog() but it does not work : BOOL CMyPropertySheet::OnInitDialog() { BOOL Stat= CPropertySheet::OnInitDialog(); CButton* pButton = (CButton*) this->GetDlgItem(IDCANCEL); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } pButton = (CButton*) this->GetDlgItem(IDOK); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } pButton = (CButton*) this->GetDlgItem(IDCLOSE); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } pButton = (CButton*) this->GetDlgItem(ID_APPLY_NOW); if(pButton) { pButton->SetButtonStyle(pButton->GetButtonStyle() | BS_FLAT); pButton->Invalidate(); } return Stat; } Pierre Couderc www.tol.fr

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              The buttons may not have those IDs. You might have to use EnumWindows() or FindWindow to search for the window with the right text.

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              P 1 Reply Last reply
              0
              • R Ryan Binns

                The buttons may not have those IDs. You might have to use EnumWindows() or FindWindow to search for the window with the right text.

                Ryan

                "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                P Offline
                P Offline
                Pierre Couderc
                wrote on last edited by
                #7

                Thank you Ryan, - the buttons DO HAVE these IDs : it is harcoded in CPropertySheet. - The good solution is CButton* pButton = (CButton*) this->GetDlgItem(IDCANCEL); if(pButton) { pButton->ModifyStyle(0,BS_FLAT);} - see thread microsoft.public.vc.mfc "Desperately trying to get flat buttons in a CPropertySheet" dated 07/02/2006 16:32 Thank you again pierre Pierre Couderc www.tol.fr

                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