MFC separate windows, set the split bar is not movable

Source: Internet
Author: User

Recently to do a project, do interface encountered this problem, find a lot of information, finally solved, in this record, I hope to have the need to help people. Well, not much to say, the specific treatment is as follows:

Create a new class Cfixsplitterwnd inherit CSplitterWnd, add

On_wm_lbuttondown ()

On_wm_setcursor ()

On_wm_mousemove ()

Three message responses, the main code is as follows:

Header file

1 protected : 2     void OnLButtonDown (UINT nflags, CPoint PT); 3     afx_msg BOOL onsetcursor (cwnd* pWnd, uint nhittest, UINT message); 4     void OnMouseMove (UINT nflags, CPoint PT); 5     Declare_message_map ()

source file

Begin_message_map (Cfixsplitterwnd, CSplitterWnd) On_wm_lbuttondown () On_wm_setcursor () On_wm_mousemove () END_ Message_map ()voidCfixsplitterwnd::onlbuttondown (UINT nflags, CPoint point) {//return directly, do not process    return; } BOOL Cfixsplitterwnd::onsetcursor (CWnd*pWnd, uint nhittest, UINT message) {      //when the cursor enters the split window, it is not allowed to change appearance, do not handle    returnFALSE;}voidCfixsplitterwnd::onmousemove (UINT nflags, CPoint point) {//change the processing of the Csplitter class to be handled by CWnd//Csplitterwnd::onmousemove (nflags, point);Cwnd::onmousemove (nflags, point);}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.