newshape.h
来自「C++Builder程序员编程手记《配书光盘》」· C头文件 代码 · 共 47 行
H
47 行
//---------------------------------------------------------------------------
#ifndef NewShapeH
#define NewShapeH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
enum TNewShapeType {sstRectangle, sstSquare, sstRoundRect, sstRoundSquare,
sstEllipse, sstCircle };
//---------------------------------------------------------------------------
class PACKAGE TNewShape : public TGraphicControl
{
private:
TNewShapeType FShape;
TPen *FPen; // 保存画笔对象的数据成员
TBrush *FBrush; // 保存刷子对象的数据成员
void __fastcall SetShape(TNewShapeType Value);
void __fastcall SetBrush(TBrush *Value); //设置刷子的方法
void __fastcall SetPen(TPen *Value); //设置画笔的方法
protected:
virtual void __fastcall Paint();
public:
__fastcall TNewShape(TComponent* Owner);
__fastcall ~TNewShape();
void __fastcall StyleChanged(TObject* Owner); // 增加的析构函数申明
__published:
__property DragCursor ;
__property DragMode ;
__property OnDragDrop ;
__property OnDragOver ;
__property OnEndDrag ;
__property OnMouseDown ;
__property OnMouseMove ;
__property OnMouseUp ;
__property TNewShapeType Shape = {read=FShape, write=SetShape, nodefault};
__property Height;
__property Width;
__property TBrush* Brush = {read=FBrush, write=SetBrush, nodefault};//刷子属性
__property TPen* Pen = {read=FPen, write=SetPen, nodefault}; //画笔属性
};
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?