unit ControlDesign; interface uses SysUtils, Classes, Controls, Windows, Graphics, uses_end; type TControlDesign = class(TControl) private protected public published property Align; property Anchors; property Constraints; property ParentShowHint; property ShowHint; property Visible; property DragCursor; property DragKind; property DragMode; property Enabled; property OnContextPopup; property OnDragDrop; property OnDragOver; property OnEndDock; property OnEndDrag; property OnMouseActivate; property OnMouseDown; property OnMouseEnter; property OnMouseLeave; property OnMouseMove; property OnMouseUp; property OnStartDock; property OnStartDrag; end; TGraphicControlDesign = class(TGraphicControl) private protected procedure Paint; override; public constructor Create(AOwner: TComponent); override; published property Align; property Anchors; property Constraints; property ParentShowHint; property ShowHint; property Visible; property DragCursor; property DragKind; property DragMode; property Enabled; property OnContextPopup; property OnDragDrop; property OnDragOver; property OnEndDock; property OnEndDrag; property OnMouseActivate; property OnMouseDown; property OnMouseEnter; property OnMouseLeave; property OnMouseMove; property OnMouseUp; property OnStartDock; property OnStartDrag; end; (*------------------------------- TCustomControlDesign = class(TCustomControl) private protected procedure Paint; override; public constructor Create(AOwner: TComponent); override; published property Align; property Anchors; property Constraints; property ParentShowHint; property ShowHint; property Visible; property DragCursor; property DragKind; property DragMode; property Enabled; property OnContextPopup; property OnDragDrop; property OnDragOver; property OnEndDock; property OnEndDrag; property OnMouseActivate; property OnMouseDown; property OnMouseEnter; property OnMouseLeave; property OnMouseMove; property OnMouseUp; property OnStartDock; property OnStartDrag; end; //-------------------------------*) procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TControlDesign]); RegisterComponents('Samples', [TGraphicControlDesign]); // RegisterComponents('Samples', [TCustomControlDesign]); end; { TGraphicControlDesign } constructor TGraphicControlDesign.Create(AOwner: TComponent); begin inherited Create(AOwner); ControlStyle := ControlStyle + [csReplicatable]; Width := 50; Height := 50; end; procedure BevelRect(Canvas: TCanvas; Color1, Color2: TColor; const R: TRect); begin with Canvas do begin Pen.Color := Color1; PolyLine([Point(R.Left, R.Bottom), Point(R.Left, R.Top), Point(R.Right, R.Top)]); Pen.Color := Color2; PolyLine([Point(R.Right, R.Top), Point(R.Right, R.Bottom), Point(R.Left, R.Bottom)]); end; end; procedure TGraphicControlDesign.Paint; begin with Canvas do begin if (csDesigning in ComponentState) then begin Pen.Style := psSolid; Pen.Mode := pmCopy; Pen.Color := clBlack; Brush.Style := bsSolid; Pen.Width := 1; BevelRect(Canvas, clBtnHighlight, clBtnShadow, Rect(0, 0, Width - 1, Height - 1)); end; end; end; (*------------------------------- { TCustomControlDesign } constructor TCustomControlDesign.Create(AOwner: TComponent); begin inherited; end; procedure TCustomControlDesign.Paint; begin with Canvas do begin if (csDesigning in ComponentState) then begin Pen.Style := psSolid; Pen.Mode := pmCopy; Pen.Color := clBlack; Brush.Style := bsSolid; Pen.Width := 1; BevelRect(Canvas, clBtnHighlight, clBtnShadow, Rect(0, 0, Width - 1, Height - 1)); end; end; end; //-------------------------------*) end.