Solved

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

Posted on 2014-10-13
6
192 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
  • 3
  • 3
6 Comments
 
LVL 33

Accepted Solution

by:
sarabande earned 500 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 33

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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

776 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