描述:
控件作为运行时不可见控件创建,但是在调用控件的一个方法之后要求创建控件窗口,变为可见。可以吗?
解决方案1:
开发控件属性中包含:背景,控件内容的可见性(对ATL,也就是TRUE时在OnDraw中提前返回.)
解决方案2: 可以啊。
一种方法是create出来后,再MoveWindow到指定的位置,再ShowWindow
另一种方法是程序初始化时隐藏控件,需要时再显示出来
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