Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows FormView Application: How do I ensure that forms fit display without scrolling.

Posted on 2014-10-13
6
Medium Priority
?
283 Views
Last Modified: 2014-10-23
I am working on a Windows Application written In Visual Studio MFC. The application has CFormView  derived child windows.  
The application was written for 14" CRT monitors. Now all the users have 24" monitors and so the forms appear small. In short, we are not making full use of screen real estate. So we decided to enlarge the forms for 1980x1080 resolution (the recommended resolution for most users).  This was good for most users, however some critical users are complaining. They are those who use dual monitors, different screen resolutions, fonts, font size. They want original screen size back. How to deal with such a situation? Is there a programmatic way?
0
Comment
Question by:Vakils
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
sarabande earned 2000 total points
ID: 40379271
there are two ways:

1. you may have two dialog resources for each form one for 1024x768 screens and one for 1980x1080 displays.

    when you create the form you may choose the one or the other dialog id depending
    on the current screen resolution (or on user preference).
    that could be done in the constructor of your formview class where the IDD was passed as argument.
   
   
CTestFormView::CTestFormView()
	: CFormView(CTestFormView::IDD)
    {
	// TODO: add construction code here
    }

Open in new window


     you would replace the CTestFormView::IDD argument like

   
CTestFormView::CTestFormView()
	: CFormView(CTestForm::UseWideResolution()? CTestFormView::IDDW : CTestFormView::IDDS)
    {
	// TODO: add construction code here
    }

Open in new window


   where TestForm::UseWideResolution would be a static function of your
   application class which returns true if a wide resolution was required.
   
   note, both the forms must have same controls.

2. You may enlarge the forms dynamically after loading the 1024x768 form resources.

     that could be done in the OnInitialUpdate function of your formview class. you would change
     font, size and/or position of the form and each control. calculating the new sizes is somewhat
     difficult as the form size is based on "dialog units" which are not scaling linearly.

Sara
0
 

Author Comment

by:Vakils
ID: 40385337
Hi Sara,
Option 2 is not feasible as we have about 40 form views each having lots of controls. Option 1, needs to be tweaked for run time. But, creating another set of views for low resolution is again a time consuming effort, which we don't have. I was looking for a solution like in web based application, Ctrl + or - would change the size of page you are viewing.  It seems that there is no such easy option for apps where each user has personalized resolution, font and it's size. Some have dual monitors. So we are going back to original resolution.
0
 
LVL 35

Expert Comment

by:sarabande
ID: 40386164
I was looking for a solution like in web based application, Ctrl + or - would change the size of page you are viewing.
why not changing your form views to html views?

Option 2 is not feasible as we have about 40 form views each having lots of controls.
you may derive a class from CFormView and derive all your form view classes from that. then you could encapsulate all the resizing stuff into the new class.

from my experience option 1 is the easiest, best looking and less error-prone method. you probably already have both the resources and the concept easily could be enhanced to additional scales if required.

Sara
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Vakils
ID: 40395801
Hi Sara,
Sorry for delayed reply. Can you attach a small sample using html view?
0
 
LVL 35

Expert Comment

by:sarabande
ID: 40396393
0
 

Author Comment

by:Vakils
ID: 40400599
Hi Sara,
Thanks for the link. From samples,  CHTMLView is used basically to render a web page or for making web browser based app, which is not the intent here. Our forms have grids and controls and data is pulled from database. and to render them in HTML would take resources (time and money) that otherwise will be used in enhancing/adding functionality to the app. Also, a HTML based web client is being developed to replace C++ MFC front-end.
In short, it's a low priority item.
But, thanks anyway, it seems the solution you gave- have two resource ID's per form window form, is simplest and elegant, but again it gets convoluted where we invoke a form window from another form window using resource ID or check whether user has access permission to a particular form.
Regards,
-vakils-
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question