[ Home ] [ Up ] [ News ] [ Applications ] [ YU applications ]




Freeware without source!

If your application has to work on different screen resolutions, then it would be nice if it could resize itself and looks like you made it for appropriate resolution. This problem is not resolved as it should (to my knowledge) and the form becomes too large to fit on the screen or too small and unreadable, sometimes unusable at all.

One possible global solution to the problem could be implementing the OnDisplayChange event to the TControl class itself, but one can find a lot of drawbacks to this approach!

Another possible global solution is what this component actually does! It hooks into owners form message handler, captures WM_DISPLAYCHANGE message and fires appropriate events for the form and each control on it. You can abandon or accept default changes and resize control yourself, if you like.

TMDisplayChange will resize your form and all components on it, having in mind it's design time size in millimeters (approximately), instead in pixels.

Since this is not an easy task to perform, if possible at all in general, (otherwise it would be probably solved by Borland Delphi or MS Windows), I tried to do it myself and I believe I am close to the solution! It works for me, you can try and use it for free! 

Properties Events Download  Feedback


Just drop the component on the form! TMDisplayChange will remember the form, screen and font sizes in pixels and will fire several events if the screen resolution is changed while the form is active or in the case your application is started on PC with different screen resolution then the design time one. TMDisplayChange traps WM_DISPLAYCHANGE message sent to all active windows, recalculates new coordinates and fires appropriate events as form and each component on it is resized!

Description  Events DownloadFeedback


property DesignTime: TSysParams;

This published, read only property encapsulates the structure with all relevant design time coordinates and sizes. While in run time mode, there is another one (publicproperty RunTime: TSysParams;) with the same structure. Look in OI for details and you will get the point!

property TraceLogMemo: TMemo;

This is "DebugOnly" property! While developing your application, you can assign some TMemo component and see the recalculated sizes and take appropriate actions or changes in your code. This should be set to nil in deployed application!

Description Properties Download Feedback


TBeforeDisplayChangeEvent = procedure(Sender: TObject;
DT, RT: TSysParams;
FormRect: TRect;
var CanResize: Boolean) of object;

This event is fired actually after the display resolution is changed but before the component code is executed so you can abandon auto resize for some resolutions if you want.

TAfterDisplayChangeEvent = procedure(Sender: TObject;
DT, RT: TSysParams; FormRect: TRect;
Resized: Boolean) of object;

This event is the last one fired and you can apply final changes to the form position, size or whatever.

TBeforeControlChangeEvent = procedure(AControl: TControl;
DT, RT: TSysParams; var CanResize: Boolean) of object;

For each control owned by the form, you may want to decide if it should resize at all, change some relevant properties (i.e. AutoSize, Constraints ) etc.

TAfterControlChangeEvent = procedure(AControl: TControl;
AControlRect: TRect) of object;

After TMDisplayChange recalculate new size and position, you may want to restore some properties (i.e. AutoSize, Constraints ) or , like the Alignment palette - "space equally, horizontally ( vertically )" adjust the space between several controls taking into account their new width or height compared with parent's one!


Description Properties Events Feedback

Download ~25 Kb

Source available on purchase Price: US $ 30.
Back to top

Copyright © 2001 Database4YoU                 Last modified: April 15, 2001