Programming 版 (精华区)
作 家: compus (蓝天) on board 'Programming'
题 目: vc编程指南68篇(3)
来 源: 哈尔滨紫丁香站
日 期: Sun Oct 26 20:09:01 1997
出 处: compus.bbs@bbs.net.tsinghua.edu.cn
发信人: Zeemon (塞下秋), 信区: Visual
标 题: vc编程指南68篇(3)
发信站: BBS 水木清华站 (Wed Oct 22 21:08:02 1997)
17、如何创建一个字回绕的CEditView
重载CWnd : : PreCreateWindow和修改CREATESTRUCT结构,关闭CEditView对象
的ES_AUTOHSCROLL和WS_HSCROLL风格位, 由于CEditView : : PreCreateWindow显示
设置cs. style,调用基类函数后要修改cs . style。
BOOL CSampleEDitView : : PreCreateWindow (CREATESTRUCT&cs)
{
//First call basse class function .
BOOL bResutl =CEditView : : PreCreateWindow (cs) ;
// Now specify the new window style .
cs.style &= ~ (ES_AUTOHSCROLL |WS_HSCROLL);
return bResult ;
}
18、通用控件的显示窗口
MFC提供了几个CView派生的视窗类, 封装了通用控件的功能,但仍然使用工
作框文档显示窗口体系结构:CEditView封装了编辑控件,CTreeView保持了树列表
控件,CListView封装了列表显示窗口控件,CRichEditView可以处理多种编辑控件。
19、移动窗口
调用CWnd : : SetWindowPos并指定SWP_NOSIZE标志。目的位置与父窗口
有关(顶层窗口与屏幕有关)。调用CWnd : : MoveWindow时必须要指定窗口
的大小。
//Move window to positoin 100 , 100 of its parent window .
SetWindowPos (NULL, 100 , 100 , 0 , 0 , SWP_NOSIZE |SWP_NOAORDER);
20、重置窗口的大小
调用CWnd: : SetWindowPos并指定SWP_NOMOVE标志, 也可调用
CWnd : : MoveWindow 但必须指定窗口的位置。
// Get the size of the window .
Crect reWindow ;
GetWindowRect (reWindow );
//Make the window twice as wide and twice as tall .
SetWindowPos (NULL , 0 , 0 , reWindow . Width ( ) *2,
reWindow . Height () * 2,
SWP_NOMOVE |SWP_NOZORDER );
--
※ 来源:·BBS 水木清华站 bbs.net.tsinghua.edu.cn·[FROM: sapphire.ncic.a]
--
※ 来源:·哈尔滨紫丁香站 bbs1.hit.edu.cn·[FROM: compus.bbs@bbs.net.t]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.036毫秒