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. set button size dynamically

set button size dynamically

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
5 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.
  • A Offline
    A Offline
    ani_ikram
    wrote on last edited by
    #1

    how can i set button size according to text size dynamically, means in run time text of button is changed using setwindowtext() method but size of button remain static either text is small or larger so how to fix it, pls help

    N 1 Reply Last reply
    0
    • A ani_ikram

      how can i set button size according to text size dynamically, means in run time text of button is changed using setwindowtext() method but size of button remain static either text is small or larger so how to fix it, pls help

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      use SetWindowPos() or MoveWindow() function to resize the button. To find out how much length a text takes, use the CDC::GetTextExtent() function or CDC::DrawText() function.

      nave [OpenedFileFinder] [My Blog]

      A 1 Reply Last reply
      0
      • N Naveen

        use SetWindowPos() or MoveWindow() function to resize the button. To find out how much length a text takes, use the CDC::GetTextExtent() function or CDC::DrawText() function.

        nave [OpenedFileFinder] [My Blog]

        A Offline
        A Offline
        ani_ikram
        wrote on last edited by
        #3

        thanks for da reply but will u plz send me code using these methods as never used before

        N H 2 Replies Last reply
        0
        • A ani_ikram

          thanks for da reply but will u plz send me code using these methods as never used before

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          ani_ikram wrote:

          u plz send me code using these methods as never used before

          So you dont want to learn vc++? Check the MSDN for the help of each function, do some sample and ask us if you face some problem while using that functions. Those functions are really easy to understand. Give a try..

          nave [OpenedFileFinder] [My Blog]

          1 Reply Last reply
          0
          • A ani_ikram

            thanks for da reply but will u plz send me code using these methods as never used before

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            Its not hard you need to a handle to your button.

            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