Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
More info
Form Designer FAQ
Form Designer Home
Delphi Components
See also
Products
Object Inspector
Runtime Fusion
Print Suite
Commented Image
Image Editor  new!
Delphi Toys
Ultimate Pack  hot!

FAQs
Object Inspector FAQ
Print Suite FAQ
Image Editor FAQ

Links
Software for .NET
Software for VB 6
Delphi Tips & Tricks

Services
Outsourcing
How to use TControlDesigner?
To use TControlDesigner just drop the component onto the form, set the Active property to True and set the Control property to determine the selected control. You can use the OnMouseDown event for all controls on your form to select the control.
procedure TfrmMain.ControlMouseDown(Sender: TObject; 
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ControlDesigner.Control:=Sender as TControl;
end;
When the control is selected, TControlDesigner draws the special frame around the control, th eframe itself allows to move control and the grabs at the corners of the frame allow to resize the control. The minimal size of the selected control is limited by the MinSize property. If the DirectDrag property is True, the control itself is moved when the user drags the frame, otherwise only gray rectangle is moved over the form and the position of selected control is changed only after finishing the dragging.

TControlDesigner allows to move and resize the selected control from the keyboard if the EnableKeys property is True. The cursor keys moves the control, to resize control use the cursor keys with Shift and the Ctrl key used when the control is move or resized from the keyboard sets the step of the changes to 8 instead of 1. If the EnableKeys property is True, the selected control losses focus after selecting and the focus is received by the frame.

You can disable the selecting or moving/resizing the control by OnAllowSelectControl and OnAllowDragControl events. The code below disallows to select the activation/deactivation button.

procedure TfrmMain.ControlDesignerAllowSelectControl(Sender: TObject;
  TheControl: TControl; var Allow: Boolean);
begin
  Allow:=TheControl<>btnActivate;
end;
After selecting the control the OnSelectControl is fired and the OnDragControl is fired when the selected control was moved or resized.

If you want to use some external editor for the selected control, the OnDblClick event can be used. This event is fired when the user double-click the edit frame around the selected control.

procedure TfrmMain.ControlDesignerDblClick(Sender: TObject);
begin
  // just showing message, but you can
  // call your own editor here
  ShowMessage(
    'Double-click on the frame.'#13+
    'Selected control is '+ControlDesigner.Control.Name);
end;

Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software