在基于对话框的应用程序中,可不可以建立SDI窗口

mideyong 2003-09-13 09:54:32
如果可以,请各位大虾举例说明
...全文
70 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Skt32 2003-09-21
  • 打赏
  • 举报
回复
An alternative to the often asked view-in-dialog problem using a dialog bar
By thom_as

In this article I show an alternative to the tricky (and thus often unstable) attempts to create a view on a dialog.

http://www.codeproject.com/dialog/view_in_dialog.asp
Skt32 2003-09-21
  • 打赏
  • 举报
回复
Child Dialog (Sub Forms)
By Daniel Zuppinger

A simple class for handling Child Dialogs within a dialog or property sheet. These Child Dialogs can be changed on the fly, much like subforms. It's a simple task really, but I got tired of programming everything everytime :-(

Step 1. Design one or several 'Subdialogs'. Make sure to set the Style to 'Child' and to tick the property 'Control'.

Step 2. Design a Parent Dialog. To make things easier I add a static control for easier positioning of the child dialogs (normally I use a group frame).

Step 3. Generate for all dialogs their classes.

Step 4. Add the files 'SubFormCollection.cpp' and 'SubFormCollection.h' to your project.

Step 5. Create an object of the class CSubFormCollection to the parent dialog.

//
CSubFormCollection m_SubForms;
//

Step 6. In the OnInitDialog() method of the parent class add the code below :

//
CRect r;
(GetDlgItem(IDC_SUBFORM_FRAME))->GetWindowRect(&r); // get the position for the subforms
// m_SubForms.SetRelPos(r); // if the positioning is absolute use this, else the next line
m_SubForms.SetCenterPos(r); // centers the subdialog within the static IDC_SUBFORM_FRAME
m_SubForms.CreateSubForm(IDD_SUBFORM1,this); // create the sub forms
m_SubForms.CreateSubForm(IDD_SUBFORM2,this);
m_SubForms.CreateSubForm(IDD_SUBFORM3,this);
m_SubForms.CreateSubForm(IDD_SUBFORM4,this);
m_SubForms.ShowSubForm(); // show the first one
//

Step 7. To switch between the subdialogs use the code below :

//
m_SubForms.ShowSubForm(index_of_subform);
//

Now the big work starts...

About Daniel Zuppinger

Professional IT developer since 1983. First projects with Cobol, then Pascal, Modula2, C and since Visual C++ 1.0 also with C++. Works since 1986 as Consultant, since 1990 for Infobrain in Switzerland.
Current field is the project management and development of software for GSM applications (TAP3).
Married, two daughters, Hobbies : Paragliding.
Click here to view Daniel Zuppinger's online profile.

http://www.codeproject.com/dialog/childdlg.asp
masterz 2003-09-13
  • 打赏
  • 举报
回复
Create a View in a dialog
http://www.codeguru.com/dialog/vwindlg.html
yzx110 2003-09-13
  • 打赏
  • 举报
回复
实际上从CWnd派生下来的类可以创建的任何地方,只要互相不冲突就行。
zhucde 2003-09-13
  • 打赏
  • 举报
回复
...
vcforever 2003-09-13
  • 打赏
  • 举报
回复
在对话框中可以加上view!
只要在你的工程中从CView派生一个类就行!
再将这个类作为子窗口加入到的你对话框中!
其做法和普通窗口的操作是一样的!

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧