splitterbar.h
来自「一个关于局域网简单抓包工具」· C头文件 代码 · 共 94 行
H
94 行
// CSplitterBar.h : header file
//
//1、将文件夹SplitterBar(SplitterBar.h,SplitterBar.cpp)拷贝到应用的文件夹中
//2、在需要切分的Dialog对话框的头文件中加入:
// #include ".\SplitterBar\SplitterBar.h"
// protected:
// CSplitterBar m_wndVSplitBar;
// CSplitterBar m_wndHSplitBar;
//3、在需要切分的Dialog的cpp文件(类)中的OnInitDialog()事件函数加入:
// //Dialog切分窗口(2行1列,下面行再分2列)
// CRect rect(0,0,0,0);
// m_wndHSplitBar.Create(WS_CHILD|WS_BORDER|WS_DLGFRAME|WS_VISIBLE,rect,this,999,TRUE);//TRUE表示水平分隔条
// m_wndHSplitBar.SetPanes(&m_listdata,&m_TreeDetail,&m_Data);
// m_wndVSplitBar.Create(WS_CHILD|WS_BORDER|WS_DLGFRAME|WS_VISIBLE,rect,this,999);
// m_wndVSplitBar.SetPanes(&m_TreeDetail,&m_Data);
//
//缺点:2行1列,第2行再分2列--不灵活
/////////////////////////////////////////////////////////////////////////////
#ifndef __SPLITTER_BAR_H__
#define __SPLITTER_BAR_H__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define WM_SPLITTER_MOVED WM_USER+1000
/////////////////////////////////////////////////////////////////////////////
// CSplitterBar
class CSplitterBar : public CWnd
{
DECLARE_DYNAMIC(CSplitterBar)
enum DRAGFLAG { DRAG_ENTER=0, DRAG_EXIT=1, DRAGGING=2 };
protected:
CRect m_rectSplitter;
CRect m_rectDragPrev;
CRect m_rectDragCurt;
BOOL m_bDragging;
CWnd *m_pwndLeftPane; //left(or upper) pane window
CWnd *m_pwndRightPane; //right(or under) pane window
CWnd *m_pwndOtherPane; //
int m_cxLeftMost; //left most, relative to parent window
int m_cxRightMost; //right most, relative to parent window
BOOL m_bHorizontal;
// Construction
public:
CSplitterBar();
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, BOOL bHorizontal=FALSE);
// Attributes
public:
BOOL IsCursorOverSplitter( const CPoint& ptCursor );
// Operations
public:
void DrawDraggingBar(CPoint point,DRAGFLAG df=DRAGGING);
void SetPanes(CWnd *pwndLeftPane,CWnd *pwndRightPane);
void SetPanes(CWnd *pwndLeftPane,CWnd *pwndRightPane,CWnd *pwndOtherPane);
void MovePanes();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSplitterBar)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSplitterBar();
// Generated message map functions
protected:
//{{AFX_MSG(CSplitterBar)
afx_msg void OnPaint();
afx_msg UINT OnNcHitTest(CPoint point);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?