?? painterfacade.h
字號:
#ifndef _PAINTER_FACADE_H__
#define _PAINTER_FACADE_H__
#define BASE_UNIT 20.0
class CPointf
{
public:
CPointf(){x = 0.0; y = 0.0;}
CPointf(double xval, double yval):x(xval), y(yval){}
double x;
double y;
};
/*************************************************************************
some draw methods which map the point of math coordinates to logical ones
notice that this class never change the properties the device content,
and user must set its properties outside this class
/*************************************************************************/
class PainterFacade
{
public:
PainterFacade(CRect& logicalRect, double dbBaseUnit = BASE_UNIT)
:m_logicalRect(logicalRect),
m_dbBaseUnit(dbBaseUnit){};
/* map the point of math coordinates to logical ones */
int MPtoLP(const CPointf *pSrcPf, CPoint *pDstP);
/* the inverse function of MPtoLP */
int LPtoMP(const CPoint *pSrcP, CPointf *pDstPf);
/* draw the math coordinate */
int DrawCoordinate(CDC *pDC);
/* draw point use method of draw ellipse */
int DrawPoint(CDC *pDC, const CPointf *pf);
/* draw point use method of draw line */
int DrawPoint(CDC *pDC, const CPointf *pf, int nPointUnit);
/* draw a line for the linear formula ax + by + c = 0 */
int DrawLine(CDC* pDC, double a, double b, double c);
int DrawEllipse(CDC* pDC, const CPointf *pf, int a, int b);
const CRect &GetRect() { return m_logicalRect; }
private:
CRect m_logicalRect;
double m_dbBaseUnit;
};
#endif /* _PAINTER_FACADE_H__ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -