CSplitterControl_对话框分割拖拉窗口控件封装类及使用例子.7z

上传者: zimu2702 | 上传时间: 2021-09-28 18:16:58 | 文件大小: 17KB | 文件类型: 7Z
vc
1、 分割控件类:CSplitterControl SplitterControl.h SplitterControl.cpp 2、创建对象、增加资源 class xx { ... private: CSplitterControl m_wndSplitter1; // 上下分割 IDC_SPLITTER_TOP 分割线资源更改资源可见属性为不可见,防止出现2条线 void DoResize1(int delta); CSplitterControl m_wndSplitter2; // 左右分割 IDC_SPLITTER_LEFT void DoResize2(int delta); } 3、初始化 BOOL CT1Dlg::OnInitDialog() { ... // TODO: Add extra initialization here {//m_wndSplitter1 CRect rc; CWnd* pWnd; pWnd = GetDlgItem(IDC_SPLITTER_TOP); pWnd->GetWindowRect(rc); ScreenToClient(rc); m_wndSplitter1.Create(WS_CHILD | WS_VISIBLE, rc, this, IDC_SPLITTER_TOP); CRect rc2; GetDlgItem(IDOK)->GetWindowRect(&rc2); ScreenToClient(&rc2); CRect rc3; GetDlgItem(IDCANCEL)->GetWindowRect(&rc3); ScreenToClient(&rc3); m_wndSplitter1.SetRange(rc2.bottom, rc3.top); } {// m_wndSplitter2 CRect rc; CWnd* pWnd; pWnd = GetDlgItem(IDC_SPLITTER_LEFT); pWnd->GetWindowRect(rc); ScreenToClient(rc); m_wndSplitter2.Create(WS_CHILD | WS_VISIBLE, rc, this, IDC_SPLITTER_LEFT); CRect rc2; GetDlgItem(IDC_BUTTON1)->GetWindowRect(&rc2); ScreenToClient(&rc2); CRect rc3; GetDlgItem(IDC_BUTTON2)->GetWindowRect(&rc3); ScreenToClient(&rc3); m_wndSplitter2.SetRange(rc2.right+1, rc3.left-1); } return TRUE; // return TRUE unless you set the focus to a control } LRESULT CT1Dlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class if (message == WM_NOTIFY) { if (wParam == IDC_SPLITTER_TOP) { SPC_NMHDR* pHdr = (SPC_NMHDR*) lParam; DoResize1(pHdr->delta); } else if (wParam == IDC_SPLITTER_LEFT) { SPC_NMHDR* pHdr = (SPC_NMHDR*) lParam; DoResize2(pHdr->delta); } } return CDialog::DefWindowProc(message, wParam, lParam); } void CT1Dlg::DoResize1(int delta) { CSplitterControl::ChangeHeight(GetDlgItem(IDC_BUTTON1),delta); CSplitterControl::ChangeHeight(GetDlgItem(IDC_BUTTON2), -delta, CW_BOTTOMALIGN); Invalidate();

文件下载

资源详情

[{"title":"( 18 个子文件 17KB ) CSplitterControl_对话框分割拖拉窗口控件封装类及使用例子.7z","children":[{"title":"CSplitterControl_对话框分割拖拉窗口控件封装类及使用例子","children":[{"title":"t1.aps <span style='color:#111;'> 34.80KB </span>","children":null,"spread":false},{"title":"StdAfx.cpp <span style='color:#111;'> 204B </span>","children":null,"spread":false},{"title":"SplitterControl.cpp <span style='color:#111;'> 7.78KB </span>","children":null,"spread":false},{"title":"resource.h <span style='color:#111;'> 818B </span>","children":null,"spread":false},{"title":"t1.clw <span style='color:#111;'> 1.15KB </span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'> 3.42KB </span>","children":null,"spread":false},{"title":"t1.dsw <span style='color:#111;'> 529B </span>","children":null,"spread":false},{"title":"StdAfx.h <span style='color:#111;'> 1.03KB </span>","children":null,"spread":false},{"title":"SplitterControl.h <span style='color:#111;'> 2.68KB </span>","children":null,"spread":false},{"title":"t1Dlg.cpp <span style='color:#111;'> 5.76KB </span>","children":null,"spread":false},{"title":"t1.dsp <span style='color:#111;'> 4.20KB </span>","children":null,"spread":false},{"title":"t1.rc <span style='color:#111;'> 5.34KB </span>","children":null,"spread":false},{"title":"res","children":[{"title":"t1.rc2 <span style='color:#111;'> 394B </span>","children":null,"spread":false},{"title":"t1.ico <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false}],"spread":true},{"title":"t1.h <span style='color:#111;'> 1.25KB </span>","children":null,"spread":false},{"title":"t1Dlg.h <span style='color:#111;'> 1.51KB </span>","children":null,"spread":false},{"title":"t1.cpp <span style='color:#111;'> 1.96KB </span>","children":null,"spread":false},{"title":"usage.txt <span style='color:#111;'> 2.28KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • no_abomb :
    够用,但功能不太强大
    2018-09-03
  • hongbai :
    可以,感谢楼主
    2016-12-27
  • alangsos :
    对 话框中控件太多是效果不好
    2016-04-25
  • uvloss :
    实现功能都比较简单基础,一般情况下需进行额外扩展,不过楼主封装做的不错,赞一个~
    2016-04-02
  • host_sh :
    效果不是很好,DEMO简单,清晰
    2014-06-18

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明