Solved

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

Posted on 2014-10-13
6
227 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 34

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 34

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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

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

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

751 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