|
-
September 14th, 1999, 12:33 AM
#1
How do I calculate the screen size of a dialog resource
Hello:
I am using a CFormView with a dialog resource that I created.
Unfortunately, the CFormView does not automatically fit to the size of the
resource I designed. Instead I get scroll bars. If I knew how to
programmaticlly determine the screen (pixel) size of the resource, I could
simply get the resource size and then set the view size equal to that size.
I'm sure there are better ways to skin this cat, and I am open to any
suggestions.
Thanks in advance,
Jim Houskeeper
-
September 14th, 1999, 12:51 AM
#2
Re: How do I calculate the screen size of a dialog resource
You can use GetWindowRect() to get the size of dialog after creating dialog.
-
September 14th, 1999, 08:27 AM
#3
Re: How do I calculate the screen size of a dialog resource
No, that was too easy, I tried that. As I tried to explain in the original post, the dialog resource is larger than the default CFormView, so the CFormView is exposed with both horizonal and vertical scroll bars, the rect you get when you query for the window size is the rect of the view, not the dialog resouce it contains. I want the view window to be exposed at the same size of the dialog resource, and thus no sliders. Any other suggestions?
Jim
-
September 14th, 1999, 11:26 AM
#4
Re: How do I calculate the screen size of a dialog resource
Sanjeev is right, you need to use GetWindowRect, but on the dialog, not the view. Not sure how you can get a pointer to the CDialog in a view like that (dont use them), but have done the following recently.
One way...To get size of arbitrary dialog, do a create of it (make it invisible if necessary), then do a getwindowrect, then delete the dialog.
As far as I can tell this is the only way of doing it, I needed to compensate for large fonts and thats what I had to do.
Rgds
James
-
September 29th, 1999, 07:43 AM
#5
Re: How do I calculate the screen size of a dialog resource
In an SDI app, you can do the following to resize your CFormView:
void CYourFormView::OnInitialUpdate()
{
CFormViewMgr::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
But somehow it did not work in an MDI app. I am still trying to figure it out.
-Patty
-
February 21st, 2006, 10:16 AM
#6
Re: How do I calculate the screen size of a dialog resource
try this (it worked for me)
void CMyFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit(FALSE);
...
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|