This component is Freeware. Probably not the most exciting thing ever seen for Delphi but I think it is still very usefull. It is a way to say thank you for all those magnificent Freeware components I had a chance to lean from. If know better ways to do things then please let me know. As I said I am always keen to learn. Email to dinther@geocities.com 

TRectBox is mainly a Canvas that can be dragged and resized during runtime. The appearance of the Canvas can be modified using the OnPaint event. Use TRectBox whenever you need to let the user define a rectangular area at runtime or to place single line text boxes.

TRectBox is pretty much a standard Graphic control with the exception of the simulated focusing mechanism. Focus shift will work automatically between TRectBoxes leaving the windows focus were it is. Unfocusing must be done in code with the RemoveAllFocus procedure.

By: Paul van Dinther  dinther@geocities.com 02/01/2000


Below a brief description of the properties, events and methods


Properties:


ActiveFrameColor: TColor

Use it to define the color of the frame when the RectBox has focus

AutoForeGround: Boolean

If set to true the Component will jump to the foreground when selected. This will give the user access to all the drag boxes as none are obscured by other TRectBoxes

AutoSize: Boolean

When set to true the component will size itself to the size of the caption.

BoxColor: TColor

The Box is in fact the drag boxes in each corner and in the middle of each line forming the rectangle. This property defines the color of the DragBox.

BoxSize: Integer

Refers to the same 8 Dragboxes as above. This property allows you to change the size of the DragBox.

Caption: String

Needs no explenation. Just pass any string to this property. The text will be displayed in the center of the Rectangle just as a TPanel does.

DrawBoxes: Boolean

This property allows you to define if the DragBoxes should be drawn or not. This applies to all TRectBoxes regardless of focus state. The Drag Function will still work.

DrawFrame: Boolean

This property allows you to define if the frame should be drawn or not. This applies to all TRectBoxes regardless of the focus state.

Focus: Boolean

When a TRectBox is selected is will automatically receive focus. Note that the focus mechanism is not the Windows Focus system as the control is not a windows control but a graphic control. When this property is set to true al other TRectBoxes from the same owner will lose focus. The only way to remove focus of all TRectBoxes is to call the RemoveAllFocus procedure.

FrameType: (ftouter,ftInner,ftMiddle)

The FrameType defines were the frame rectangle is drawn in relation to the DragBoxes. The default is ftOuter thus aligning the Frame rectangle with the size of the control. If you use ftInner or ftMiddle then you need to calculate your own area as indicated by the frame rectangle.

HidePassiveFrame: Boolean

The Frame rectangle does not get drawn when set to true in case the conponent has focus. This is by the way always the case for the drag boxes that only get drawn when the component has focus.

PassiveFrameColor: TColor

If HidePassiveFrame is set to False then this property will control the Frame color when the control has no focus.

ShowPos: Boolean

When set to true the position of the control will be shown when in focus. font and location of this information can not be modified.

ShowSize: Boolean

When set to true the Size of the control will be shown when in focus. font and location of this information can not be modified.

InfoTextColor: TColor

Although Component position and Size information can not be changed, it is possible to modify the text color with this property


Events:

OnPaint

procedure Paint(Sender: TObject; Canvas: TCanvas; Rect: TRect);

Use this event handler if you need to apply your own painting in the control. This event occurs before the regular paint events for the control occur. For this purpose the Canvas and client area are passed to the event handler as well.



Methods:

Procedure RemoveAllFocus;

The focus system in use is exclusive for the TRectBox and has nothing to do with the Windows Focusing system. Therefore you need to manually remove focus from the TRectBox. Focus changes automatically when another TRectBox is selected.
