shape.h

来自「《MFC经典问答》pdf格式 拿出来大家共享一下」· C头文件 代码 · 共 39 行

H
39
字号
#pragma once

//////////////////////////////////////////////////////
// CShape

// Note: this class really should be divided into a
// hierarchy with a "CShape" abstract base class and
// several derived classes "CCircle", "CSquare", etc.
//
// However, the following "everything-in-one-class"
// implementation is easier to understand and very
// straightfoward, given the limited scope of this
// sample project.

class CShape : public CObject
{
    DECLARE_SERIAL( CShape )

public:
	enum SHAPE { SQUARE = 0, CIRCLE = 1 };
	enum { HALF_SIZE = 70 };

    CShape( CPoint ptCenter, COLORREF crColor, SHAPE shape );

    void Draw( CDC* pDC ) const;
    void DrawAt( CDC* pDC, int x, int y ) const;

	CString GetShapeName() const;

protected:
	CShape();		// for serialization only
    virtual void Serialize(CArchive& ar);

public:
	CPoint m_ptCenter;
	COLORREF m_crColor;
	SHAPE m_shape;
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?