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 make a project resolution independent.?

How to make a project resolution independent.?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++comhelptutorial
10 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.
  • M Offline
    M Offline
    mbatra31
    wrote on last edited by
    #1

    Hi, I have one question regarding resolution. How to make a project created as a MFC dialog based application, resolution independent. I am using a number of images in our dialog based project. But the final display using images and controls is not resolution independent. To say if your PC screen resolution is different from the other, it will not properly display the dialog. Some of the part of dialog display will be cut-off. How to make the same resolution independent, so that irrespective of the resolution of the device or screen size, display should be same. Any help will be appreciated. Also, what is the use of ActiveX controls in MFC.? Regards, Mbatra

    J A 2 Replies Last reply
    0
    • M mbatra31

      Hi, I have one question regarding resolution. How to make a project created as a MFC dialog based application, resolution independent. I am using a number of images in our dialog based project. But the final display using images and controls is not resolution independent. To say if your PC screen resolution is different from the other, it will not properly display the dialog. Some of the part of dialog display will be cut-off. How to make the same resolution independent, so that irrespective of the resolution of the device or screen size, display should be same. Any help will be appreciated. Also, what is the use of ActiveX controls in MFC.? Regards, Mbatra

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      I assume that your dialog is created using a resource template. The simple solution is to limit the size of the dialog to the minimum size of supported screen resolutions. If your application must also run on small screens, you may add a second dialog template with smaller controls and smaller total size. Upon program start, choose the small template when necessary. The complex solution would be making your dialog and some or all controls resizable. But this requires proper calculation for sizes and positions of all controls. Regarding ActiveX There is no need to use ActiveX controls if your application design can be done using the standard Windows and MFC controls. If you have special control requirements, you can build your own controls by using ActiveX or plain C++ code, or use existing controls that fit your requirements. Finally, it's up to you to decide to use ActiveX controls or not.

      M 1 Reply Last reply
      0
      • J Jochen Arndt

        I assume that your dialog is created using a resource template. The simple solution is to limit the size of the dialog to the minimum size of supported screen resolutions. If your application must also run on small screens, you may add a second dialog template with smaller controls and smaller total size. Upon program start, choose the small template when necessary. The complex solution would be making your dialog and some or all controls resizable. But this requires proper calculation for sizes and positions of all controls. Regarding ActiveX There is no need to use ActiveX controls if your application design can be done using the standard Windows and MFC controls. If you have special control requirements, you can build your own controls by using ActiveX or plain C++ code, or use existing controls that fit your requirements. Finally, it's up to you to decide to use ActiveX controls or not.

        M Offline
        M Offline
        mbatra31
        wrote on last edited by
        #3

        Hi, Thanx for your reply. It is not that my project will run on smaller screeens only. It may run on larger screens also. Let me explain, I have windows 7 & my PC screen is of bigger size (vertically as well as horizantally) (bigger than a normal LCD display). if I run my project on my PC, I am not able to see the controls on the bottom of the dialog. if I run my project on any PC with windows XP and screen size is small, it will display it perfectly. I want to make it like that all the controls should adjust them accordingly irrespective of the resolution or PC screen size. Any help will be appreciated. Regards, Mbatra

        J 1 Reply Last reply
        0
        • M mbatra31

          Hi, Thanx for your reply. It is not that my project will run on smaller screeens only. It may run on larger screens also. Let me explain, I have windows 7 & my PC screen is of bigger size (vertically as well as horizantally) (bigger than a normal LCD display). if I run my project on my PC, I am not able to see the controls on the bottom of the dialog. if I run my project on any PC with windows XP and screen size is small, it will display it perfectly. I want to make it like that all the controls should adjust them accordingly irrespective of the resolution or PC screen size. Any help will be appreciated. Regards, Mbatra

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          I'm confused now. The display is OK on small screens but the bottom controls aren't visible on a big screen? At least you should tell us about your dialog. Is it a template based CDialog or a CDHtmlDialog?

          M 1 Reply Last reply
          0
          • J Jochen Arndt

            I'm confused now. The display is OK on small screens but the bottom controls aren't visible on a big screen? At least you should tell us about your dialog. Is it a template based CDialog or a CDHtmlDialog?

            M Offline
            M Offline
            mbatra31
            wrote on last edited by
            #5

            Hi, its a template based CDialog. Regards, Mbatra

            J 1 Reply Last reply
            0
            • M mbatra31

              Hi, its a template based CDialog. Regards, Mbatra

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #6

              But then I don't understand why portions are not visible on a big screen. Because with a template based CDialog the size of the dialog and sizes and positions of all controls are defined in the template. As long as nothing is changed by code, the dialog should be shown like in the resource editor. If the screen is larger than the dialog, your app should be opened with centered dialog. If the screen is too small, the right and/or bottom sides are clipped.

              M 1 Reply Last reply
              0
              • J Jochen Arndt

                But then I don't understand why portions are not visible on a big screen. Because with a template based CDialog the size of the dialog and sizes and positions of all controls are defined in the template. As long as nothing is changed by code, the dialog should be shown like in the resource editor. If the screen is larger than the dialog, your app should be opened with centered dialog. If the screen is too small, the right and/or bottom sides are clipped.

                M Offline
                M Offline
                mbatra31
                wrote on last edited by
                #7

                Hi, Sorry for any confusion. What I understand is, we are using images for all the controls, whether its a button, static control, slider control etc..... So i thought the image size will never change irrespective of the resolution or the size of the screen. Because image size will remain the same. its a dialog based app, I also want to understand what makes it that when I open it on screens with different sizes, some controls at the bottom are not visible. Regards, Mbatra

                J 1 Reply Last reply
                0
                • M mbatra31

                  Hi, Sorry for any confusion. What I understand is, we are using images for all the controls, whether its a button, static control, slider control etc..... So i thought the image size will never change irrespective of the resolution or the size of the screen. Because image size will remain the same. its a dialog based app, I also want to understand what makes it that when I open it on screens with different sizes, some controls at the bottom are not visible. Regards, Mbatra

                  J Offline
                  J Offline
                  Jochen Arndt
                  wrote on last edited by
                  #8

                  Even with images the sizes of the controls are usually not resolution dependant because this would require repositioning inside the dialog to avoid overlapping. It seems that you are using non standard controls but custom ones. So you should have a look into the sources and/or the documentation of these custom controls to know what happens. You may also use the debugger to check if missing controls are created or not and get the sizes and positions of these controls (e.g. by calling GetWindowRect() and printing the values to the debug output window using TRACE).

                  1 Reply Last reply
                  0
                  • M mbatra31

                    Hi, I have one question regarding resolution. How to make a project created as a MFC dialog based application, resolution independent. I am using a number of images in our dialog based project. But the final display using images and controls is not resolution independent. To say if your PC screen resolution is different from the other, it will not properly display the dialog. Some of the part of dialog display will be cut-off. How to make the same resolution independent, so that irrespective of the resolution of the device or screen size, display should be same. Any help will be appreciated. Also, what is the use of ActiveX controls in MFC.? Regards, Mbatra

                    A Offline
                    A Offline
                    Alan Balkany
                    wrote on last edited by
                    #9

                    Design all your dialogs for the smallest resolution. Then when your application runs, check the resolution and see how much extra space you have in the X and Y directions. Divide this extra space among the controls in your dialog. The extra space shouldn't be divided equally -- Some controls benefit more from extra space than others. For example, a Static or Edit control wouldn't be helped by more Y-direction space, but a List Box would be able to show more items. Likewise, some space between controls will appear better when extended than other space. For each dialog, you can list the percentage of extra space you want to add to each control.

                    "Microsoft -- Adding unnecessary complexity to your work since 1987!"

                    K 1 Reply Last reply
                    0
                    • A Alan Balkany

                      Design all your dialogs for the smallest resolution. Then when your application runs, check the resolution and see how much extra space you have in the X and Y directions. Divide this extra space among the controls in your dialog. The extra space shouldn't be divided equally -- Some controls benefit more from extra space than others. For example, a Static or Edit control wouldn't be helped by more Y-direction space, but a List Box would be able to show more items. Likewise, some space between controls will appear better when extended than other space. For each dialog, you can list the percentage of extra space you want to add to each control.

                      "Microsoft -- Adding unnecessary complexity to your work since 1987!"

                      K Offline
                      K Offline
                      Kimcopeland
                      wrote on last edited by
                      #10

                      ohhhh

                      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