Discussion:
MFC View Orientation and Size
(too old to reply)
Ed II
2009-03-17 10:42:01 UTC
Permalink
Hello,
I am writing a MDI Doc/View application using CFormView. At Program start I
open always the same documents and I want to arrange the views in the same
orientation as at the last run. Each View may have a different size. The sum
of all Views represent a complete System.
My problem is, that I could not serialize the correct Parameters and then
define the correct View at start up of the application. Since all my
approaches failed I am using
pMainFrame->MDITile(MDITILE_SKIPDISABLED);
which is not what I want.


One of my last attempts was to serialize the coordinates at
CMyMDIChild::OnDestroy()
{
CView* pView = GetActiveView();
CRect objRect;
pView->GetClientRect(&objRect);

}

and to reuse the coordinates in

CMyMDIChild::PreCreateWindow(CREATESTRUCT& cs)
{}

by modifying the cs-Coordinates, but this failed.

Is it generally possible to arrange the Views in a MDI Doc/View application,
or is this limited by the Framework.

I would highly appreciate any comments which will help to fix this problem.
Best regards
ed
Tom Serface
2009-03-18 13:46:55 UTC
Permalink
I would do this sort of thing in the OnClose() function. You can set the
size of the window in PreCreateWindow(), but without seeing the code it
would be difficult to know what's going wrong. Maybe you could a frame
library like:

http://www.codeproject.com/KB/docview/smartframes.aspx

Tom
Post by Ed II
Hello,
I am writing a MDI Doc/View application using CFormView. At Program start I
open always the same documents and I want to arrange the views in the same
orientation as at the last run. Each View may have a different size. The sum
of all Views represent a complete System.
My problem is, that I could not serialize the correct Parameters and then
define the correct View at start up of the application. Since all my
approaches failed I am using
pMainFrame->MDITile(MDITILE_SKIPDISABLED);
which is not what I want.
One of my last attempts was to serialize the coordinates at
CMyMDIChild::OnDestroy()
{
CView* pView = GetActiveView();
CRect objRect;
pView->GetClientRect(&objRect);
}
and to reuse the coordinates in
CMyMDIChild::PreCreateWindow(CREATESTRUCT& cs)
{}
by modifying the cs-Coordinates, but this failed.
Is it generally possible to arrange the Views in a MDI Doc/View application,
or is this limited by the Framework.
I would highly appreciate any comments which will help to fix this problem.
Best regards
ed
Ed II
2009-03-19 00:44:10 UTC
Permalink
Hi Tom,
thank you. That was exactly what I was looking for.
By the way. I have another question. Is it possible to define one of the
views transparent. I would like to arrange all but 1 views like in the
SmartFrames-example. 1 View (a Robot) should be able to interact with the
other views and therefore it should have a transparent frame. Is this
possible using MFC?

Thank you for your quick reply.
Ed
Post by Tom Serface
I would do this sort of thing in the OnClose() function. You can set the
size of the window in PreCreateWindow(), but without seeing the code it
would be difficult to know what's going wrong. Maybe you could a frame
http://www.codeproject.com/KB/docview/smartframes.aspx
Tom
Post by Ed II
Hello,
I am writing a MDI Doc/View application using CFormView. At Program start I
open always the same documents and I want to arrange the views in the same
orientation as at the last run. Each View may have a different size. The sum
of all Views represent a complete System.
My problem is, that I could not serialize the correct Parameters and then
define the correct View at start up of the application. Since all my
approaches failed I am using
pMainFrame->MDITile(MDITILE_SKIPDISABLED);
which is not what I want.
One of my last attempts was to serialize the coordinates at
CMyMDIChild::OnDestroy()
{
CView* pView = GetActiveView();
CRect objRect;
pView->GetClientRect(&objRect);
}
and to reuse the coordinates in
CMyMDIChild::PreCreateWindow(CREATESTRUCT& cs)
{}
by modifying the cs-Coordinates, but this failed.
Is it generally possible to arrange the Views in a MDI Doc/View application,
or is this limited by the Framework.
I would highly appreciate any comments which will help to fix this problem.
Best regards
ed
Loading...