首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

能否在运行时动态的改变控件的可见性解决思路

2012-01-26 
能否在运行时动态的改变控件的可见性控件作为运行时不可见控件创建,但是在调用控件的一个方法之后要求创建

能否在运行时动态的改变控件的可见性
控件作为运行时不可见控件创建,但是在调用控件的一个方法之后要求创建控件窗口,变为可见。可以吗?

[解决办法]
CWnd::ShowWindow
BOOL ShowWindow( int nCmdShow );

Return Value

Nonzero if the window was previously visible; 0 if the CWnd was previously hidden.

Parameters

nCmdShow

Specifies how the CWnd is to be shown. It must be one of the following values:

SW_HIDE Hides this window and passes activation to another window.


SW_MINIMIZE Minimizes the window and activates the top-level window in the system’s list.


SW_RESTORE Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position.


SW_SHOW Activates the window and displays it in its current size and position.


SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.


SW_SHOWMINIMIZED Activates the window and displays it as an icon.


SW_SHOWMINNOACTIVE Displays the window as an icon. The window that is currently active remains active.


SW_SHOWNA Displays the window in its current state. The window that is currently active remains active.


SW_SHOWNOACTIVATE Displays the window in its most recent size and position. The window that is currently active remains active.


SW_SHOWNORMAL Activates and displays
[解决办法]
可以啊。
一种方法是create出来后,再MoveWindow到指定的位置,再ShowWindow
另一种方法是程序初始化时隐藏控件,需要时再显示出来
[解决办法]
开发控件属性中包含:背景,控件内容的可见性(对ATL,也就是TRUE时在OnDraw中提前返回.)

热点排行