Class TAspect (unit Aspect)

Inherits from

TComponent

Constructors


constructor Create (AOwner : TComponent);



Functions

destructor Destroy;

default conditions

procedure EstablishAspectRatio (Side : word; var Rect : TRect);

Take a rect and force an aspect ratio on it, the pulled by value effects which side is adjusted to make the aspect ratio work.

procedure Loaded;

chuck the object instance

procedure NewDefWndProc (var Msg : TMessage);

are we controlling the client or whole ratio

the Side contains a value indicating what is to be adjusted actually uses the WMSZ_XXXX values which is the side being pulled or the corner being pulled (eight choices).


Properties

property Active : boolean

activate the aspect ratio control

property AspectX : integer

set the X part of the aspect ratio

property AspectY : integer

set the Y part of the aspect ratio

property Client : boolean

does the ratio apply to the client area (T) or to the whole form area (F)?

Events

event OnBeforeResizing : TBeforeResizingEvent


event OnModifyClient : TModClientEvent


Variables

FActive : boolean;

it is the ratio that matters.

FAspectX : integer;


FAspectY : integer;

X aspect and YAspect are relatively unimportant

FClient : boolean;

is the component effect on or off

FNewDefWndProc : pointer;


FOldDefWndProc : pointer;

these are used to subclass the form

FOnBeforeResizing : TBeforeResizingEvent;


FOnModifyClient : TModClientEvent;


FParent : THandle;



Constructors


constructor Create (AOwner : TComponent);


Functions


destructor Destroy;

default conditions


procedure EstablishAspectRatio (Side : word; var Rect : TRect);

Take a rect and force an aspect ratio on it, the pulled by value effects which side is adjusted to make the aspect ratio work. saXXXX constants are used.


procedure Loaded;

chuck the object instance


procedure NewDefWndProc (var Msg : TMessage);

are we controlling the client or whole ratio

the Side contains a value indicating what is to be adjusted actually uses the WMSZ_XXXX values which is the side being pulled or the corner being pulled (eight choices). So calculate Right, Top, Bottom or Left values. The combinations set here are based on what feels "right" for me, some experimentation for your feel may be necessary. If you change this behaviour, you may need to change the saXXXX constants as well.


Properties


property Active : boolean

activate the aspect ratio control


property AspectX : integer

set the X part of the aspect ratio


property AspectY : integer

set the Y part of the aspect ratio


property Client : boolean

does the ratio apply to the client area (T) or to the whole form area (F)?


Events


event OnBeforeResizing : TBeforeResizingEvent


event OnModifyClient : TModClientEvent


Variables


FActive : boolean;

it is the ratio that matters.


FAspectX : integer;


FAspectY : integer;

X aspect and YAspect are relatively unimportant


FClient : boolean;

is the component effect on or off


FNewDefWndProc : pointer;


FOldDefWndProc : pointer;

these are used to subclass the form


FOnBeforeResizing : TBeforeResizingEvent;


FOnModifyClient : TModClientEvent;


FParent : THandle;