Solved

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

Posted on 2014-10-13
6
204 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

828 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