Rectangle.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:1k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // Rectangle.cpp: implementation of the CRectangle class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "Rectangle.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CRectangle::CRectangle( CDrawView * view ) : CDraw( view )
- {
- this->type = RECT;
- }
- CRectangle::~CRectangle()
- {
- }
- void CRectangle::MouseMove( UINT nFlags , CPoint point )
- {
- if( nFlags & MK_SHIFT )
- { //计算最小的边
- int min = min( abs( point.x - this->start.x ) , abs( point.y - this->start.y ) );
- //计算最小的矩形
- point.x = this->start.x + ( point.x > this->start.x ? 1 : -1 ) * min;
- point.y = this->start.y + ( point.y > this->start.y ? 1 : -1 ) * min;
- }
- CDraw::MouseMove( nFlags , point );
- }
- CDC * CRectangle::Draw( CDC * pDC )
- {
- pDC = CDraw::Draw( pDC );
- if( pDC )
- {
- CRect rc( this->start , this->end );
- rc.NormalizeRect( );
- pDC->Rectangle( rc );
- }
- return pDC;
- }