📄 index188.htm
字号:
<html>
<style type="text/css"><!--
.p9 { font-family: "宋体"; font-size: 9pt}a {text-transform: none; text-decoration: none;}
a:hover {text-decoration: underline; color: #FF0000;}
--></style>
<body background="../di2001.jpg">
<h3 align="center"><font COLOR="#AOAO99"></font></h3>
<table width="100%" border="1" cellspacing="1">
<tr><td><p align="center"><font color="#FF0000">用MFC制作弹出窗口</font></td></tr>
<tr><td><p>
</Br>
我正在试着用MFC来制作弹出窗口,我看过一些关于建立弹出窗口的文章,它们是使用 CWnd对象的。但在文档,视窗结构中是怎样实现的?<Br>
</Br>
你可以建立一个非模态对话框(使用Create函数),你可以在任何建立窗口,子窗口等。如果你一定要在文档、视窗结构中实现,你也可以用CCreateContest类。下面是建立MDI窗口的例子:<Br>
</Br>
</Br>
{<Br>
LPCTSTR lpszClassName = NULL;<Br>
CCreateContext cContext;<Br>
</Br>
cContext.m_pNewViewClass = RUNTIME_CLASS ( CMyView )<Br>
</Br>
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW &<Br>
~WS_THICKFRAME & ~WS_MAXIMIZEBOX;<Br>
</Br>
// TODO: Add your specialized code here and/or call the base class<Br>
</Br>
if ( CMDIChildWnd::Create(lpszClassName, lpszWindowName, dwStyle,<Br>
pParentWnd->rectDefault, pParentWnd, &cContext) )<Br>
{<Br>
InitialUpdateFrame ( NULL, TRUE );<Br>
CScrollView *pView = ( CScrollView* ) GetActiveView();<Br>
</Br>
if ( pView )<Br>
pView->ResizeParentToFit ( FALSE );<Br>
</Br>
return TRUE;<Br>
}<Br>
else<Br>
return FALSE;<Br>
}<Br>
CCreateContext有一个成员为m_pCurrentDoc,你可以用它来将一个文档分配到相应的窗口上.<Br>
</Br>
</Br>
</p></td></tr>
</table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -