📄 meanlineunit.cpp
字号:
// MeanLineUnit.cpp: implementation of the CMeanLineUnit class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "WellDataProcess.h"
#include "MeanLineUnit.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMeanLineUnit::CMeanLineUnit()
{
}
CMeanLineUnit::~CMeanLineUnit()
{
}
CMeanLineUnit::operator=(const CMeanLineUnit& other)
{
m_color = other.m_color;
m_nStartPos = other.m_nStartPos;
m_nEndPos = other.m_nEndPos;
m_nXPos = other.m_nXPos;
m_fMeanValue = other.m_fMeanValue;
}
void CMeanLineUnit::SetMeanLineColor(COLORREF color)
{
m_color = color;
}
void CMeanLineUnit::SetStartPos(int nStartPos)
{
m_nStartPos = nStartPos;
}
void CMeanLineUnit::SetEndPos(int nEndPos)
{
m_nEndPos = nEndPos;
}
void CMeanLineUnit::SetXPos(int nXPos)
{
m_nXPos = nXPos;
}
void CMeanLineUnit::SetMeanValue(float fMeanValue)
{
m_fMeanValue = fMeanValue;
}
COLORREF CMeanLineUnit::GetMeanLineColor()
{
return m_color;
}
int CMeanLineUnit::GetStartPos()
{
return m_nStartPos;
}
int CMeanLineUnit::GetEndPos()
{
return m_nEndPos;
}
int CMeanLineUnit::GetXPos()
{
return m_nXPos;
}
float CMeanLineUnit::GetMeanValue()
{
return m_fMeanValue;
}
void CMeanLineUnit::Draw(CDC *pDC)
{
CPen pen;
COLORREF color;
if(m_bSelect)
color = RGB(255, 255, 255);
else
color = m_color;
pen.CreatePen(PS_SOLID, 2, color);
CPen* pOldPen = pDC->SelectObject(&pen);
pDC->MoveTo(m_nXPos, m_nStartPos);
pDC->LineTo(m_nXPos, m_nEndPos);
pDC->SelectObject(pOldPen);
}
BOOL CMeanLineUnit::HitTest(int x, int y)
{
int x1 = m_nXPos - 2;
int x2 = m_nXPos + 2;
if(x >= x1 && x <= x2 && y >= m_nStartPos && y <= m_nEndPos)
{
m_bSelect = TRUE;
return TRUE;
}
m_bSelect = FALSE;
return FALSE;
}
BOOL CMeanLineUnit::HitTest(CPoint point)
{
if(HitTest(point.x, point.y))
return TRUE;
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -