⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 no_sysmenu.shtml.htm

📁 mfc资料集合5
💻 HTM
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Zafir Anjum">
   <TITLE>Menu - Remove system menu from floating toolbar</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" tppabs="http://www.codeguru.com/fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td><A HREF="http://209.66.99.126/cgi/ads.cgi?advert=myad2"><IMG SRC="../../209.66.99.126/advertise2.gif" tppabs="http://209.66.99.126/advertise2.gif" ALT="" BORDER=2></A><td>
</tr>
</table>


<CENTER><H3><FONT COLOR="#AOAO99">Remove system menu from floating toolbar</FONT></H3></CENTER>
<HR>




This article was contributed by <A HREF="mailto:S.Saxena@pbc.be.philips.com">Sushil Saxena</A>.


<P>When a toolbar floats, the MFC framework normally supplies a window menu
(formerly known as system menu) to the toolbar. The toolbar can be
floated by a double click or by dragging it to the center of the screen.
This code demonstrates how to do it.

<P>Note: I could not get the mini frame window to repaint. So I had to
first hide and then show the toolbar to achieve the same effect. I tried
UpdateWindow, SetWindowPos, MoveWindow etc. Suggestions welcome.

<P>1. Derive your own toolbar CMyToolBar from CToolBar and update the
m_wndToolBar member in the main frame.

<P>2. In CMyToolBar::OnLButtonDblClk(...), add the following:

<PRE><TT><FONT COLOR="#990000">
	CToolBar::OnLButtonDblClk(...); //fill the parameters 

	if (IsFloating()) //is toolbar floating
	{
		CWnd* pMiniFrame;
		CWnd* pDockBar;

		pDockBar = GetParent();
		pMiniFrame = pDockBar->GetParent();

		//get rid of window menu
		pMiniFrame->ModifyStyle(WS_SYSMENU, NULL);

		//extreme way of re-painting the toolbar
		pMiniFrame->ShowWindow(SW_HIDE);
		pMiniFrame->ShowWindow(SW_SHOW);
	}
</FONT></TT></PRE>

<P>3. Repeat same code in OnLButtonDown(...) and elsewhere.



















<P>
<P>
<HR>
<TABLE BORDER=0 WIDTH="100%" >
<TR>
<TD WIDTH="33%"><FONT SIZE=-1><A HREF="../index.htm" tppabs="http://www.codeguru.com/">Goto HomePage</A></FONT></TD>

<TD WIDTH="33%">
<CENTER><FONT SIZE=-2>&copy; 1997 Zafir Anjum</FONT>&nbsp;</CENTER>
</TD>

<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact me: <A HREF="mailto:zafir@home.com">zafir@home.com</A>&nbsp;</FONT></DIV>
</TD>
</TR>
</TABLE>
<CENTER><FONT SIZE=-2>6630</FONT></CENTER>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -