📄 rect.cpp
字号:
// Rect.cpp: implementation of the Rect class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PainterUsePattern.h"
#include "Rect.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//=================================================================
//
//=================================================================
Rect::Rect()
{
}
//=================================================================
//
//=================================================================
Rect::~Rect()
{
}
//=================================================================
//接受访问者访问方法;
//=================================================================
void Rect::Accept( AbstractVisitor& v , CDC* pDC )
{
v.VisitRect( this ,pDC );
}
//=================================================================
//检测点p是否在显示区域内部;
//=================================================================
bool Rect::Intersects( CPoint p )
{
int flag1 = ( p.x >= m_rect.left && p.x <= m_rect.right )? true : false;
int flag2 = ( p.y >= m_rect.top && p.y <= m_rect.bottom)? true : false;
if( flag1 && flag2 )
return true;
return false;
}
//=================================================================
//设置显示位置偏移量;
//=================================================================
void Rect::SetOffset( int offsetX , int offsetY )
{
m_rect.top += offsetY;
m_rect.bottom += offsetY;
m_rect.left += offsetX;
m_rect.right += offsetX;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -