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

📄 subject_26968.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:26968 发表者:美丽的小东西 发表日期:2003-01-07 10:42:49
<br>主题:救急!!如何锁定锁定切分条??
<br>内容:请教VC大侠:<BR>&nbsp;&nbsp;&nbsp;&nbsp;我做了一个单文档多视图的界面,想把分隔条锁定,如何实现?以下的代码我看不懂,希望能遇高人指点!!!!!谢谢!!!!<BR><BR>/////////////////////////////////////////////////<BR>当用户创建好分割窗口后,有时并不希望通过拖动切分条来调节窗口的大小。这时就必须锁定切分条。锁定切分条的最简单的方法莫过于不让CSplitterWnd来处理WM_LBUTTONDOWN,WM_MOUSEMOVE,WM_SETCURSOR消息,而是将这些消息交给CWnd窗口进行处理,从而屏蔽掉这些消息。拿WM_LBUTTONDOWN处理过程来说。修改为如下: <BR>void CXXSplitterWnd::OnLButtonDown(UINT nFlags,CPoint point) { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CWnd::OnLButtonDown(nFlags,point);<BR>} <BR>其余的处理方法类似。 <BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2003-01-07 11:29:21
<br>内容:下面的方法摘自微软的Knowledge Base的文章:“Q105150 OWTO: Prevent Static Splitter Bars from Tracking”。 <BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;SUMMARY <BR>&nbsp;&nbsp;&nbsp;&nbsp;======= <BR>&nbsp;&nbsp;&nbsp;&nbsp;In addition to providing the ability to dynamically split a single view, the CSplitterWnd class provides a convenient method of displaying two or more view classes in a single frame. This type of splitter window is called a "static splitter." The CSplitterWnd class contains member functions that allow the splitter bar to be dragged by the mouse or moved using the keyboard to change the proportionate sizes of the views (or panes, in splitter terminology) within the frame. <BR>&nbsp;&nbsp;&nbsp;&nbsp;Sometimes it is desirable to fix the initial position of the splitter bars and not allow the user to move them. This can be accomplished simply by deriving a class from CSplitterWnd and overriding several members. This method is outlined below. <BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;MORE INFORMATION <BR>&nbsp;&nbsp;&nbsp;&nbsp;================ <BR>&nbsp;&nbsp;&nbsp;&nbsp;1. Use ClassWizard to create a new class named CMySplitterWnd of class type "generic CWnd" and change the references to CWnd in the class declaration and BEGIN_MESSAGE_MAP macro to CSplitterWnd. <BR>&nbsp;&nbsp;&nbsp;&nbsp;2. Using ClassWizard, create message handlers for WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_MOUSEMOVE. Bypass the CSplitterWnd functionality in each of these overrides by calling the corresponding CWnd handlers. The following example illustrates the WM_LBUTTONDOWN handler: <BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; void CMySplitterWnd::OnLButtonDown(UINT nFlags, Cpoint point) <BR>&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp; CWnd::OnLButtonDown(nFlags, point); <BR>&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;3. Change any embedded CSplitterWnd members of your frame class to type CMySplitterWnd. <BR>&nbsp;&nbsp;&nbsp;&nbsp;4. Remove any menu items that generate a ID_WINDOW_SPLIT command (such as the "Split" item on the VIEWEX sample's "Window" menu). This prevents CView::OnSplitCmd() from being called.&nbsp;&nbsp;<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2003-01-07 11:36:36
<br>内容:我觉得不太好解释~!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2003-01-07 11:38:40
<br>内容:代码的意思是对splitter bar的鼠标操作消息都给它变相的屏蔽掉~!<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2003-01-07 11:39:40
<br>内容:事实上可以理解为重载了splitter bar的鼠标操作消息!!!!!!!!!!!!!!!!!!!!!!!!!<BR><BR>2003-1-7 11:40:25

⌨️ 快捷键说明

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