📄 rectlineunit.cpp
字号:
// RectLineUnit.cpp: implementation of the CRectLineUnit class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "WellDataProcess.h"
#include "RectLineUnit.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRectLineUnit::CRectLineUnit()
{
m_bSelect = FALSE;
}
CRectLineUnit::~CRectLineUnit()
{
}
CRectLineUnit::operator = (const CRectLineUnit& other)
{
m_p1 = other.m_p1;
m_p2 = other.m_p2;
m_pRect1 = other.m_pRect1;
m_pRect2 = other.m_pRect2;
}
BOOL CRectLineUnit::HitTest(CPoint point)
{
int y = point.y;
int my = m_p1.y ;
if (y > my - 2 && y < my + 2 && point.x < m_p2.x && point.x > m_p1.x)
{
m_bSelect = TRUE;
return TRUE;
}
m_bSelect = FALSE;
return FALSE;
}
void CRectLineUnit::Draw(CDC* pDC)
{
COLORREF color = RGB(255,0,0);
if (m_bSelect)
color = RGB(255, 255,255);
CPen pen(PS_SOLID,2,color);
CPen* pOldPen = pDC->SelectObject (&pen);
pDC->MoveTo(m_p1);
pDC->LineTo (m_p2);
pDC->SelectObject (pOldPen);
}
CRectLineUnit::CRectLineUnit(CPoint point,int nWidth)
{
m_p1 = point;
m_p2 = CPoint(point.x + nWidth,point.y );
}
CRectLineUnit::CRectLineUnit(int x,int y,int nWidth)
{
m_p1 = CPoint(x,y);
m_p2 = CPoint(x+nWidth,y);
}
void CRectLineUnit::Offset(int dx,int dy)
{
m_p1.Offset (dx,dy);
m_p2.Offset (dx,dy);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -