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. SetWindowRgn() for buttons

SetWindowRgn() for buttons

Scheduled Pinned Locked Moved C / C++ / MFC
question
13 Posts 4 Posters 1 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.
  • A Asha Udupa

    It won't work even with reference.

    T Offline
    T Offline
    ThatsAlok
    wrote on last edited by
    #4

    First Set the Style of Button to Owner Draw!

    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

    cheers, Alok Gupta

    A 1 Reply Last reply
    0
    • T ThatsAlok

      First Set the Style of Button to Owner Draw!

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta

      A Offline
      A Offline
      Asha Udupa
      wrote on last edited by
      #5

      If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.

      B T 2 Replies Last reply
      0
      • A Asha Udupa

        If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.

        B Offline
        B Offline
        Behzad Ebrahimi
        wrote on last edited by
        #6

        For more information see one of stuff on this site such as: http://www.codeproject.com/buttonctrl/cxskinbutton.asp[^] I think you must use SelectClipRgn(...) after SetWindowRgn(...) BeB

        A 1 Reply Last reply
        0
        • B Behzad Ebrahimi

          Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(**&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&**the_rect); ....

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

          Behzad Ebrahimi wrote: Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&the_rect); CRect has an operator that returns an LPRECT or LPCRECT, so his code was perfectly valid.

          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"

          B 1 Reply Last reply
          0
          • B Behzad Ebrahimi

            For more information see one of stuff on this site such as: http://www.codeproject.com/buttonctrl/cxskinbutton.asp[^] I think you must use SelectClipRgn(...) after SetWindowRgn(...) BeB

            A Offline
            A Offline
            Asha Udupa
            wrote on last edited by
            #8

            SelectClipRgn(..) didn't help........

            1 Reply Last reply
            0
            • A Asha Udupa

              If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #9

              After Setting Owner Draw Style, You have to use [CButton::DrawItem]to draw button. Or take a look at button wrapper classes here at CP [Link] http://www.codeproject.com/buttonctrl/[^]

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta

              A 1 Reply Last reply
              0
              • T ThatsAlok

                After Setting Owner Draw Style, You have to use [CButton::DrawItem]to draw button. Or take a look at button wrapper classes here at CP [Link] http://www.codeproject.com/buttonctrl/[^]

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta

                A Offline
                A Offline
                Asha Udupa
                wrote on last edited by
                #10

                I don't want to owner draw the button. I just need to change the shape of it. Any other solution?

                T 2 Replies Last reply
                0
                • A Asha Udupa

                  I don't want to owner draw the button. I just need to change the shape of it. Any other solution?

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #11

                  I Belive I have to make one for you. Wait for hour,I will send you demo application!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta

                  1 Reply Last reply
                  0
                  • A Asha Udupa

                    I don't want to owner draw the button. I just need to change the shape of it. Any other solution?

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #12

                    I found some good article relating to your problem:- http://www.codeproject.com/buttonctrl/polybtn.asp[^] http://www.codeproject.com/buttonctrl/roundbuttons.asp[^]

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta

                    1 Reply Last reply
                    0
                    • R Ryan Binns

                      Behzad Ebrahimi wrote: Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&the_rect); CRect has an operator that returns an LPRECT or LPCRECT, so his code was perfectly valid.

                      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"

                      B Offline
                      B Offline
                      Behzad Ebrahimi
                      wrote on last edited by
                      #13

                      Thanks Ryan. You are right.:-O:doh: I always use refrence tag to take my code more readable.:rolleyes:

                      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