📄 ~separator.~cpp
字号:
// Separator.cpp : implementation file
//
#include "stdafx.h"
#include "..\dvrmanager.h"
#include "Separator.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSeparator
CSeparator::CSeparator(): m_dir(dirHorizontal), width(1), cl(RGB(0,0,0))
{
}
CSeparator::~CSeparator()
{
}
BEGIN_MESSAGE_MAP(CSeparator, CStatic)
//{{AFX_MSG_MAP(CSeparator)
ON_WM_PAINT()
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSeparator message handlers
void CSeparator::set_dir(sep_dir d)
{
m_dir = d;
RedrawWindow();
}
void CSeparator::set_cl(COLORREF c)
{
cl = c;
}
void CSeparator::set_width(int w)
{
width = w;
}
void CSeparator::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rc;
GetClientRect(rc);
CPen pp(PS_SOLID, 1, cl);
CPen* p = dc.SelectObject(&pp);
dc.MoveTo(rc.TopLeft());
if( m_dir == dirHorizontal )
{
dc.LineTo(rc.right, rc.top);
}
else
{
dc.LineTo(rc.left, rc.bottom);
}
dc.SelectObject(p);
// Do not call CStatic::OnPaint() for painting messages
}
BOOL CSeparator::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -