如何动态为Dialog加上、去掉TITL??

真糨糊 2001-12-31 01:36:12
如何动态为Dialog加上、去掉TITL??
...全文
118 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
zzdaa 2001-12-31
  • 打赏
  • 举报
回复
God ,这么简单的题目,你为什么不给他们加分????
真糨糊 2001-12-31
  • 打赏
  • 举报
回复
upupup
捕鲸叉 2001-12-31
  • 打赏
  • 举报
回复
YourDialogWnd->SetWindowText((CString)YourTitle)
真糨糊 2001-12-31
  • 打赏
  • 举报
回复
upup
A_Qiao 2001-12-31
  • 打赏
  • 举报
回复
这样试试:
CYourDialog dlg ;
.....

if( !bHasCaption )
{
dlg.ModifyStyle( WS_CAPTION, 0 ) ; // remove caption(title)
dlg.ModifyStyle( WS_OVERLAPPED, 0 ) ; // WS_OVERLAPPED imply WS_CAPTION
}
else
dlg.ModifyStyle( 0, WS_CAPTION ) ; // add caption( title )

如果还不行,研究一下MSDN对WS_***的解释:

Window Styles
WS_BORDER Creates a window that has a border.


WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style.


WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style.


WS_CLIPCHILDREN Excludes the area occupied by child windows when you draw within the parent window. Used when you create the parent window.


WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only.


WS_DISABLED Creates a window that is initially disabled.


WS_DLGFRAME Creates a window with a double border but no title.


WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style FALSE after the first control belong to the same group. The next control with the WS_GROUP style starts the next group (that is, one group ends where the next begins).


WS_HSCROLL Creates a window that has a horizontal scroll bar.


WS_MAXIMIZE Creates a window of maximum size.


WS_MAXIMIZEBOX Creates a window that has a Maximize button.


WS_MINIMIZE Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only.


WS_MINIMIZEBOX Creates a window that has a Minimize button.


WS_OVERLAPPED Creates an overlapped window. An overlapped window usually has a caption and a border.


WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.


WS_POPUP Creates a pop-up window. Cannot be used with the WS_CHILD style.


WS_POPUPWINDOW Creates a pop-up window with the WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION style must be combined with the WS_POPUPWINDOW style to make the Control menu visible.


WS_SYSMENU Creates a window that has a Control-menu box in its title bar. Used only for windows with title bars.


WS_TABSTOP Specifies one of any number of controls through which the user can move by using the TAB key. The TAB key moves the user to the next control specified by the WS_TABSTOP style.


WS_THICKFRAME Creates a window with a thick frame that can be used to size the window.


WS_VISIBLE Creates a window that is initially visible.


WS_VSCROLL Creates a window that has a vertical scroll bar.
真糨糊 2001-12-31
  • 打赏
  • 举报
回复
to A_Qiao():
去不掉啊,只是让标题栏不可用了,怎样才能是标题栏没有?
A_Qiao 2001-12-31
  • 打赏
  • 举报
回复
CYourDialog dlg ;
.....

if( !bHasCaption )
dlg.ModifyStyle( WS_CAPTION, 0 ) ; // remove caption(title)
else
dlg.ModifyStyle( 0, WS_CAPTION ) ; // add caption( title )
真糨糊 2001-12-31
  • 打赏
  • 举报
回复
我的意思是标题栏。
lengnuan 2001-12-31
  • 打赏
  • 举报
回复
no.

BOOL ModifyStyle( DWORD dwRemove, DWORD dwAdd, UINT nFlags = 0 );
and
void SetWindowText( LPCTSTR lpszString );
sxbyl 2001-12-31
  • 打赏
  • 举报
回复
SetWindowText

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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