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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get the width and height of the Form Template

How to get the width and height of the Form Template

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestionlearning
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.
  • J Offline
    J Offline
    Joschwenk666
    wrote on last edited by
    #1

    Hallo, I use a tabbed Dialog, which shows several Dialogs in it. The tabbed Dialog is resized to the size of its MDI Window. The problem is, that if the MDI Window is resized to a smaller size then the dialog in the tabbed control, the dialog in the tabbed control is not shown completely. So I want to know not the window rect of the dialog in the tabbed dialog, but the size of my form template, which I designed in the form editor of Visual C++ 6 So my main question is: Is it possible to get the height and with of my form as it is in the editor, so to speak the size of my, for example, IDD_MAIN_DIALOG resource my CDialog derived class? Thank you for your help!

    A 1 Reply Last reply
    0
    • J Joschwenk666

      Hallo, I use a tabbed Dialog, which shows several Dialogs in it. The tabbed Dialog is resized to the size of its MDI Window. The problem is, that if the MDI Window is resized to a smaller size then the dialog in the tabbed control, the dialog in the tabbed control is not shown completely. So I want to know not the window rect of the dialog in the tabbed dialog, but the size of my form template, which I designed in the form editor of Visual C++ 6 So my main question is: Is it possible to get the height and with of my form as it is in the editor, so to speak the size of my, for example, IDD_MAIN_DIALOG resource my CDialog derived class? Thank you for your help!

      A Offline
      A Offline
      Abhi Lahare
      wrote on last edited by
      #2

      use GetWindowRect() function to get rectangle for the dialog box and then a simple math will solve your problem

      J 1 Reply Last reply
      0
      • A Abhi Lahare

        use GetWindowRect() function to get rectangle for the dialog box and then a simple math will solve your problem

        J Offline
        J Offline
        Joschwenk666
        wrote on last edited by
        #3

        But the Problem is, that I get the current size of my form with GetWindowRect(). If it has already been scaled to small, some of the form controls will not be shown...I need the height and width of my Form as I see it in the form Editor...

        A 1 Reply Last reply
        0
        • J Joschwenk666

          But the Problem is, that I get the current size of my form with GetWindowRect(). If it has already been scaled to small, some of the form controls will not be shown...I need the height and width of my Form as I see it in the form Editor...

          A Offline
          A Offline
          Abhi Lahare
          wrote on last edited by
          #4

          One way I could think is store your original dialog rectangle in some variable and use those values in InitDialog() Function. The other dirty way, you can check the the dialog box co-ordinates in .rc file. and set the Dialogbox rectangle to those value in InitDilaog fuction(). HTH

          G 1 Reply Last reply
          0
          • A Abhi Lahare

            One way I could think is store your original dialog rectangle in some variable and use those values in InitDialog() Function. The other dirty way, you can check the the dialog box co-ordinates in .rc file. and set the Dialogbox rectangle to those value in InitDilaog fuction(). HTH

            G Offline
            G Offline
            Graham Breach
            wrote on last edited by
            #5

            The dialog units are not in pixels though - see the GetDialogBaseUnits()[^] function for details.

            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