⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flexprops.hpp

📁 FlexGraphics是一套创建矢量图形的VCL组件
💻 HPP
📖 第 1 页 / 共 3 页
字号:
{
	typedef TCustomProp inherited;
	
private:
	int FCapStyle;
	bool FFixedSize;
	int FSize;
	bool FFixedOutlineColor;
	Graphics::TColor FOutlineColor;
	bool FFixedFillColor;
	Graphics::TColor FFillColor;
	void __fastcall SetCapStyle(const int Value);
	void __fastcall SetFillColor(const Graphics::TColor Value);
	void __fastcall SetFixedFillColor(const bool Value);
	void __fastcall SetFixedOutlineColor(const bool Value);
	void __fastcall SetFixedSize(const bool Value);
	void __fastcall SetOutlineColor(const Graphics::TColor Value);
	void __fastcall SetSize(const int Value);
	
protected:
	virtual AnsiString __fastcall GetDisplayValue();
	
public:
	__fastcall TLineCapProp(TPropList* AOwner, const AnsiString AName);
	__fastcall virtual ~TLineCapProp(void);
	int __fastcall GetActiveSize(int PenWidth, int PixelSize);
	
__published:
	__property int CapStyle = {read=FCapStyle, write=SetCapStyle, default=0};
	__property bool FixedSize = {read=FFixedSize, write=SetFixedSize, default=0};
	__property int Size = {read=FSize, write=SetSize, default=8000};
	__property bool FixedOutlineColor = {read=FFixedOutlineColor, write=SetFixedOutlineColor, default=0
		};
	__property Graphics::TColor OutlineColor = {read=FOutlineColor, write=SetOutlineColor, default=0};
	__property bool FixedFillColor = {read=FFixedFillColor, write=SetFixedFillColor, default=0};
	__property Graphics::TColor FillColor = {read=FFillColor, write=SetFillColor, default=16777215};
};


#pragma option push -b-
enum TPenEndCap { pecFlat, pecSquare, pecRound };
#pragma option pop

#pragma option push -b-
enum TPenJoin { pjBevel, pjMiter, pjRound };
#pragma option pop

class DELPHICLASS TPenProp;
class PASCALIMPLEMENTATION TPenProp : public TCustomProp 
{
	typedef TCustomProp inherited;
	
private:
	int __fastcall GetActiveWidth(void);
	void __fastcall SetColor(const Graphics::TColor Value);
	HIDESBASE void __fastcall SetStyle(const Graphics::TPenStyle Value);
	void __fastcall SetWidth(const int Value);
	void __fastcall SetMode(const Graphics::TPenMode Value);
	void __fastcall SetEndCap(const TPenEndCap Value);
	void __fastcall SetJoin(const TPenJoin Value);
	void __fastcall SetSolidAsInside(const bool Value);
	
protected:
	Graphics::TPenStyle FStyle;
	Graphics::TColor FColor;
	Graphics::TPenMode FMode;
	int FWidth;
	TPenEndCap FEndCap;
	TPenJoin FJoin;
	bool FSolidAsInside;
	virtual AnsiString __fastcall GetDisplayValue();
	
public:
	__fastcall TPenProp(TPropList* AOwner, const AnsiString AName);
	virtual void __fastcall Setup(Graphics::TCanvas* Canvas, int Scale);
	void __fastcall GetPaintData(int &AWidth, Graphics::TPenStyle &AStyle, bool &IsGeometricPen, int Scale
		);
	__property int ActiveWidth = {read=GetActiveWidth, nodefault};
	
__published:
	__property Graphics::TColor Color = {read=FColor, write=SetColor, default=0};
	__property Graphics::TPenStyle Style = {read=FStyle, write=SetStyle, default=0};
	__property Graphics::TPenMode Mode = {read=FMode, write=SetMode, default=4};
	__property int Width = {read=FWidth, write=SetWidth, default=1000};
	__property TPenEndCap EndCap = {read=FEndCap, write=SetEndCap, default=2};
	__property TPenJoin Join = {read=FJoin, write=SetJoin, default=2};
	__property bool SolidAsInside = {read=FSolidAsInside, write=SetSolidAsInside, default=1};
public:
	#pragma option push -w-inl
	/* TCustomProp.Destroy */ inline __fastcall virtual ~TPenProp(void) { }
	#pragma option pop
	
};


class DELPHICLASS TFontProp;
class PASCALIMPLEMENTATION TFontProp : public TCustomProp 
{
	typedef TCustomProp inherited;
	
private:
	Graphics::TFont* FFont;
	int FFontHeight;
	Graphics::TFontCharset __fastcall GetCharset(void);
	HFONT __fastcall GetHandle(void);
	int __fastcall GetSize(void);
	HIDESBASE AnsiString __fastcall GetName();
	Graphics::TFontPitch __fastcall GetPitch(void);
	Graphics::TFontStyles __fastcall GetStyle(void);
	Graphics::TColor __fastcall GetColor(void);
	int __fastcall GetPixelsPerInch(void);
	void __fastcall SetCharset(const Graphics::TFontCharset Value);
	void __fastcall SetColor(const Graphics::TColor Value);
	void __fastcall SetHandle(const HFONT Value);
	void __fastcall SetHeight(const int Value);
	void __fastcall SetName(const AnsiString Value);
	void __fastcall SetPitch(const Graphics::TFontPitch Value);
	void __fastcall SetSize(const int Value);
	HIDESBASE void __fastcall SetStyle(const Graphics::TFontStyles Value);
	void __fastcall SetPixelsPerInch(const int Value);
	
protected:
	virtual AnsiString __fastcall GetDisplayValue();
	
public:
	__fastcall TFontProp(TPropList* AOwner, const AnsiString AName);
	__fastcall virtual ~TFontProp(void);
	virtual void __fastcall Setup(Graphics::TCanvas* Canvas, int Scale);
	virtual bool __fastcall Edit(void);
	void __fastcall GetFont(Graphics::TFont* &AFont);
	void __fastcall SetFont(const Graphics::TFont* AFont);
	__property HFONT Handle = {read=GetHandle, write=SetHandle, nodefault};
	
__published:
	__property int PixelsPerInch = {read=GetPixelsPerInch, write=SetPixelsPerInch, stored=false, nodefault
		};
	__property Graphics::TFontCharset Charset = {read=GetCharset, write=SetCharset, default=1};
	__property Graphics::TColor Color = {read=GetColor, write=SetColor, default=0};
	__property int Height = {read=FFontHeight, write=SetHeight, stored=false, nodefault};
	__property AnsiString Name = {read=GetName, write=SetName};
	__property Graphics::TFontPitch Pitch = {read=GetPitch, write=SetPitch, default=0};
	__property int Size = {read=GetSize, write=SetSize, nodefault};
	__property Graphics::TFontStyles Style = {read=GetStyle, write=SetStyle, default=0};
};


typedef void __fastcall (__closure *TPicturePaintBufferEvent)(System::TObject* Sender, Flexalpha::TAlphaBuffer* 
	Buffer, Graphics::TCanvas* Canvas, Graphics::TGraphic* Graphic, bool &DrawDefault);

class DELPHICLASS TPictureProp;
class PASCALIMPLEMENTATION TPictureProp : public TCustomProp 
{
	typedef TCustomProp inherited;
	
private:
	Graphics::TPicture* FPicture;
	TMetaClass*FGraphicClass;
	bool FEmpty;
	int FWidth;
	int FHeight;
	int FColumns;
	int FRows;
	bool FMasked;
	Graphics::TColor FMaskColor;
	bool FBuffered;
	Classes::TMemoryStream* FPictureBuffer;
	AnsiString FLinkName;
	bool FUsePaintBuffer;
	bool FDrawing;
	TPicturePaintBufferEvent FOnPaintFastBuffer;
	bool __fastcall GetIsLoaded(void);
	Windows::TRect __fastcall GetImgRect(int Index);
	Windows::TRect __fastcall GetCellSizeRect();
	Graphics::TGraphic* __fastcall GetGraphic(void);
	void __fastcall PictureChange(System::TObject* Sender);
	void __fastcall SetGraphic(const Graphics::TGraphic* Value);
	void __fastcall SetColumns(const int Value);
	void __fastcall SetRows(const int Value);
	void __fastcall SetMaskColor(const Graphics::TColor Value);
	void __fastcall SetMasked(const bool Value);
	void __fastcall SetBuffered(const bool Value);
	void __fastcall SetFastBuffer(const bool Value);
	void __fastcall SetLinkName(const AnsiString Value);
	bool __fastcall StoreGraphic(void);
	bool __fastcall StoreLinkName(void);
	
protected:
	Flexalpha::TAlphaBuffer* FPaintBuffer;
	virtual void __fastcall SetPropValue(const AnsiString PropName, const Variant &Value);
	virtual Variant __fastcall GetPropValue(const AnsiString PropName);
	virtual TPropType __fastcall GetPropType(const AnsiString PropName);
	virtual AnsiString __fastcall GetDisplayValue();
	virtual bool __fastcall GetIsRaster(void);
	virtual Graphics::TBitmap* __fastcall GetFrameBitmap(Graphics::TGraphic* Graphic, int FrameIndex);
	void __fastcall RefreshPaintBuffer(void);
	virtual void __fastcall PaintBufferStore(System::TObject* Sender, Graphics::TCanvas* Canvas, Graphics::TGraphic* 
		Graphic);
	
public:
	__fastcall TPictureProp(TPropList* AOwner, const AnsiString AName);
	__fastcall virtual ~TPictureProp(void);
	void __fastcall Draw(Graphics::TCanvas* Canvas, Windows::TRect &R, int FrameIndex, bool ClipTransparent
		, Flexalpha::TAlphaBuffer* DestBuffer);
	void __fastcall Clear(bool RemoveLink);
	bool __fastcall UpdateImageLink(void);
	Graphics::TPicture* __fastcall CreatePictureFromBuffer(void);
	void __fastcall LoadFromStream(Classes::TStream* Stream);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromFile(const AnsiString FileName);
	void __fastcall SaveToFile(const AnsiString FileName);
	__property bool Buffered = {read=FBuffered, write=SetBuffered, nodefault};
	__property TMetaClass* GraphicClass = {read=FGraphicClass};
	__property int Width = {read=FWidth, nodefault};
	__property int Height = {read=FHeight, nodefault};
	__property bool IsLoaded = {read=GetIsLoaded, nodefault};
	__property bool IsRaster = {read=GetIsRaster, nodefault};
	__property Windows::TRect ImgRect[int Index] = {read=GetImgRect};
	__property Windows::TRect CellSizeRect = {read=GetCellSizeRect};
	__property TPicturePaintBufferEvent OnPaintFastBuffer = {read=FOnPaintFastBuffer, write=FOnPaintFastBuffer
		};
	
__published:
	__property Graphics::TGraphic* Graphic = {read=GetGraphic, write=SetGraphic, stored=StoreGraphic};
	__property int Columns = {read=FColumns, write=SetColumns, default=1};
	__property int Rows = {read=FRows, write=SetRows, default=1};
	__property bool Masked = {read=FMasked, write=SetMasked, default=0};
	__property Graphics::TColor MaskColor = {read=FMaskColor, write=SetMaskColor, default=0};
	__property AnsiString LinkName = {read=FLinkName, write=SetLinkName, stored=StoreLinkName};
	__property bool FastBuffer = {read=FUsePaintBuffer, write=SetFastBuffer, default=0};
};


#pragma option push -b-
enum TBackgroundPictureOption { bpOffsetLeft, bpOffsetTop, bpNewWidth, bpNewHeight, bpStretchHoriz, 
	bpStretchVert, bpScaledSize, bpCenterHoriz, bpCenterVert, bpAlignRight, bpAlignBottom };
#pragma option pop

typedef Set<TBackgroundPictureOption, bpOffsetLeft, bpAlignBottom>  TBackgroundPictureOptions;

class DELPHICLASS TBackgroundOptionsProp;
class PASCALIMPLEMENTATION TBackgroundOptionsProp : public TCustomProp 
{
	typedef TCustomProp inherited;
	
private:
	bool FBrushEnabled;
	bool FPictureEnabled;
	TBackgroundPictureOptions FPictureOptions;
	int FTop;
	int FLeft;
	int FWidth;
	int FHeight;
	bool __fastcall GetCenter(void);
	bool __fastcall GetStretch(void);
	void __fastcall SetBrushEnabled(const bool Value);
	void __fastcall SetPictureEnabled(const bool Value);
	void __fastcall SetPictureOptions(const TBackgroundPictureOptions Value);
	void __fastcall SetTop(int Value);
	void __fastcall SetLeft(int Value);
	void __fastcall SetWidth(int Value);
	void __fastcall SetHeight(int Value);
	void __fastcall SetStretch(bool Value);
	void __fastcall SetCenter(bool Value);
	
protected:
	virtual AnsiString __fastcall GetDisplayValue();
	
public:
	__fastcall TBackgroundOptionsProp(TPropList* AOwner, const AnsiString AName);
	Windows::TRect __fastcall GetPicturePaintRect(TPictureProp* Picture, const Windows::TRect &BackgroundRect
		, int Scale);
	void __fastcall Draw(Graphics::TCanvas* Canvas, Windows::TRect &R, TPictureProp* Picture, TBrushProp* 
		Brush, int Scale, const Windows::TRect &PanelRefreshRect, bool ClipTransparent);
	__property bool Stretch = {read=GetStretch, write=SetStretch, default=1};
	__property bool Center = {read=GetCenter, write=SetCenter, default=0};
	
__published:
	__property bool PictureEnabled = {read=FPictureEnabled, write=SetPictureEnabled, default=1};
	__property bool BrushEnabled = {read=FBrushEnabled, write=SetBrushEnabled, default=1};
	__property TBackgroundPictureOptions PictureOptions = {read=FPictureOptions, write=SetPictureOptions
		, default=112};
	__property int Top = {read=FTop, write=SetTop, default=0};
	__property int Left = {read=FLeft, write=SetLeft, default=0};
	__property int Width = {read=FWidth, write=SetWidth, default=0};
	__property int Height = {read=FHeight, write=SetHeight, default=0};
public:
	#pragma option push -w-inl
	/* TCustomProp.Destroy */ inline __fastcall virtual ~TBackgroundOptionsProp(void) { }
	#pragma option pop
	
};


struct TPropRefItem
{
	TCustomProp* Prop;
	System::ShortString PropName;
	Variant *Data;
} ;

typedef int __fastcall (__closure *TGetIDAlias)(int OldID);

//-- var, const, procedure ---------------------------------------------------
static const Word DefaultLineCapSize = 0x1f40;
static const Shortint psNoCap = 0x0;
static const Shortint psArrow0 = 0xffffffff;
static const Shortint psDblArrow0 = 0xfffffffe;
static const Shortint psBackArrow0 = 0xfffffffd;
static const Shortint psBackDblArrow0 = 0xfffffffc;
static const Shortint psArrow1 = 0xfffffffb;
static const Shortint psDblArrow1 = 0xfffffffa;
static const Shortint psBackArrow1 = 0xfffffff9;
static const Shortint psBackDblArrow1 = 0xfffffff8;
static const Shortint psArrow = 0xfffffff7;
static const Shortint psTriangle = 0xfffffff6;
static const Shortint psDblTriangle = 0xfffffff5;
static const Shortint psBackTriangle = 0xfffffff4;
static const Shortint psBackDblTriangle = 0xfffffff3;
static const Shortint psSquare = 0xfffffff2;
static const Shortint psCircle = 0xfffffff1;
static const Shortint psDotCircle = 0xfffffff0;
static const Shortint psRhombus = 0xffffffef;
static const Shortint psThinRect = 0xffffffee;
static const Shortint psLastStandard = 0xffffffee;
extern PACKAGE TPictureLinkResolve ResolvePictureLink;
extern PACKAGE TBitmapLinkResolve ResolveBitmapLink;
extern PACKAGE bool GeometricPenChecked;
extern PACKAGE bool GeometricPenEnabled;
extern PACKAGE void __fastcall RegisterDefaultPropEditForm(TMetaClass* PropClass, TMetaClass* EditFormClass
	);

}	/* namespace Flexprops */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Flexprops;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// FlexProps

⌨️ 快捷键说明

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