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


Dyamically determining the pixel size of a CFormView resource

Posted on 1999-06-30
Medium Priority
Last Modified: 2013-11-20
I have a great many "dialogs" of type FormView that I created in the resource editor.  These dialogs eventually get linked to a frame within a CMultiDocTemplate and then are displayed on the screen.  Considering the detail of these forms, I would like them to come up as a specific size and be resizable within certain limits.  I have already figured out how to give it a starting pixel size and constrain it to certain pixel limits (thank you to any who may have helped me).  My problem is that the resources' pixel sizes, which are easily determinable on my machine, are actually different on other people's machines (making the frame appear too big or too small for the view).  Consequently I would like to dynamically figure out the size of these CFormView resources.
Question by:jaredg27
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
  • 4
  • 3
LVL 23

Expert Comment

ID: 1308487
HOWTO: Translate Dialog-Box Size Units to Screen Units

HOWTO: Calculate Dialog Base Units with Non-System-Based Font

HOWTO: Calculate Dialog Units When Not Using the System Font

Author Comment

ID: 1308488
the dialog based units to screen units information would have been great stuff, but it only works with CDialogs and I am using CFormView objects.  The other two sites applied more to screen drawing commands and calculations of font sizes than to dynamically determining the size of my form(considering I knew nothing about the fonts within the form).  Thank you for the help though.

Author Comment

ID: 1308489
I solved the problem with CScrollView's GetTotalSize():
CSize formViewSize = GetTotalSize();
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1308490
But I have a new question along the same topic:

How does one dynamically figure out the distance from a control to a dialog edge.  I haven't even investigated it enough yet, but I'm gonna dive in now...

Expert Comment

ID: 1308491
The inside client edge or the outside window edge?

Accepted Solution

cpopin earned 150 total points
ID: 1308492
CRect rCtrl, rWnd;

int dxLeft = rCtrl.left - rWnd.left;
int dxRight = rWnd.right - rCtrl.right;
int dxTop = -;
int dxBottom = rWnd.bottom - rCtrl.bottom;

Expert Comment

ID: 1308493
The answer I just gave is for the inside client edge (thought that would be most useful to you).

Author Comment

ID: 1308494
i already solved this question (as i noted in my notes), but i have to give up the points anyways

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

721 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