给你个框架,详细代码看Mastering Delphi6,我就不浪费这里的空间了。
type
TMdWArrowDir = (adUp, adLeft, adDown, adRight);
TMdWArrow = class (TCustomControl)
private
fDirection: TMdWArrowDir;
fArrowHeight: Integer;
fFilled: Boolean;
fPen: TPen;
fBrush: TBrush;
fArrowDblClick: TNotifyEvent;
fArrowPoints: array [0..3] of TPoint;
procedure ComputePoints;
procedure SetDirection (Value: TMdWArrowDir);
procedure SetArrowHeight (Value: Integer);
procedure SetFilled (Value: Boolean);
procedure SetPen (Value: TPen);
procedure SetBrush (Value: TBrush);
procedure RepaintRequest (Sender: TObject);
procedure WMLButtonDblClk (var Msg: TWMLButtonDblClk);
message wm_LButtonDblClk;
protected
procedure Paint; override;
procedure ArrowDblClick; dynamic;
public
constructor Create (AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds (ALeft, ATop, AWidth, AHeight: Integer); override;
published
property Width default 50;
property Height default 20;
property Direction: TMdWArrowDir
read fDirection write SetDirection default adRight;
property ArrowHeight: Integer
read fArrowHeight write SetArrowHeight default 10;
property Filled: Boolean
read fFilled write SetFilled default False;
property Pen: TPen
read fPen write SetPen;
property Brush: TBrush
read fBrush write SetBrush;
property OnClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnArrowDblClick: TNotifyEvent
read fArrowDblClick write fArrowDblClick;
end;