Dyamically determining the pixel size of a CFormView resource

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.
jaredg27Asked:
Who is Participating?
 
cpopinConnect With a Mentor Commented:
CRect rCtrl, rWnd;
GetWindowRect(&rWnd);
m_lbMyListBox.GetWindowRect(&rCtrl);

int dxLeft = rCtrl.left - rWnd.left;
int dxRight = rWnd.right - rCtrl.right;
int dxTop = rCtrl.top - rWnd.top;
int dxBottom = rWnd.bottom - rCtrl.bottom;
0
 
chensuCommented:
HOWTO: Translate Dialog-Box Size Units to Screen Units
http://support.microsoft.com/support/kb/articles/q74/2/80.asp

HOWTO: Calculate Dialog Base Units with Non-System-Based Font
http://support.microsoft.com/support/kb/articles/q125/6/81.asp

HOWTO: Calculate Dialog Units When Not Using the System Font
http://support.microsoft.com/support/kb/articles/q145/9/94.asp
0
 
jaredg27Author Commented:
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.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jaredg27Author Commented:
I solved the problem with CScrollView's GetTotalSize():
CSize formViewSize = GetTotalSize();
0
 
jaredg27Author Commented:
******************------------------****************
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...
0
 
cpopinCommented:
The inside client edge or the outside window edge?
0
 
cpopinCommented:
The answer I just gave is for the inside client edge (thought that would be most useful to you).
0
 
jaredg27Author Commented:
i already solved this question (as i noted in my notes), but i have to give up the points anyways
0
All Courses

From novice to tech pro — start learning today.