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.?
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.
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.
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.
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.
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.
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).
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!"
Last Visit: 31-Dec-99 18:00 Last Update: 17-Sep-14 0:03