Copyright: Helpfile Generated by HelpWriter!


Contents
Clever Resizer Contents

Overview

Setup

Methods

Properties

Limitations

Registration

Support

Copyright

Help file generated by VB HelpWriter.


Overview

Copyright	Registration	Properties	Methods

Quick Start

The ClevRes wizard enables you to quickly and easily make your forms dynamic. You do not need to know anything about the methods and properties of the CClevRes class, the wizard will generate all the necessary code for you and tell you which of the form's procedures to copy it to.

What is so clever about this resizer?

You are clever! You know what your users would like! Would they like all their controls resizable? All fixed? Some resizable and some fixed? One fixed and the rest accomodate around it? Would they like font sizes to get bigger when they enlarge their forms, or would they just like to see more information at one time? Would they like to have the ability to quickly toggle these two font size options? Would they like their forms to remember where they were when they last closed them and what size?

Clever Resizer gives you a lot of control over your controls with just a little bit of effort! By using the ClevRes wizard you can customize the dynamic aspect of your forms in minutes! If the functionality provided by the CCLevRes class is not quite what you want, you can do something about it. When you register Clever Resizer, you receive the CClevRes class as pure VB4 commented source code! You can tweek it exactly the way you would like it!

Using The ClevRes wizard

The  ClevRes wizard itself demonstrates some of the functionality which Clever Resizer can give to your forms. The wizard is purposefully built to be used while you are building your projects' forms. Here are some of it's features:

•	Resizable!

•	Memory!

•	Toggle Memory!

•	Enlarged Steps!

•	Enlarged Text Box!

•	Toggle Font Size!

•	Help!

•	Toggle Help!

•	Speed!

•	Max & Min!

•	More!

Helpful Messages

Whether you use the ClevRes wizard or follow the reference information in these help files you are unlikely to go wrong when programming the  CClevRes class. However, in the unlikely event of the class not working as desired, there is some built in error handling to give you (the programmer) information about the problem. Where ever possible a solution to the problem is suggested!

These helpful messages are just for your benefit  (the programmer). After debugging your project and before making your final EXE you can reduce the amount of code which is compiled by not including this error handling code (see Setup for the 2 easy steps required to achieve this).

Power Users

If you would like to know more details about the methods and properties of the CClevRes class, they are all fully explained in this help file along with several useful tips. Although the ClevRes wizard is highly versatile and will suffice to make most forms dynamic the way you would like them, there are still some extra methods and properties which are not fully exploited by the wizard. They are listed below as advanced methods/properties and can give you even more control over your forms.

The following table lists the functions which Clever Resizer will give to your project's forms and the methods/properties related to those functions. Most forms will only require usage of the common methods/properties.

Methods/Properties

Function	Common	Advanced

Resizability	Form	Added

MDIForm	Moved

Resize	ResetDimensions

MinWidth

MinHeight

Customized Controls	Enlarge	ResetRestrictedCtr

RestrictCtr	ShrinkFixedControls

RestrictAll

Auto-Font-Size	MaxFontSize

Position	Center

RatioMove

Auto-Position	RememberForm	ChkRememberForm

Help file generated by VB HelpWriter.


Methods
Clever Resizer Methods

Properties

Added Method

Center Method

Enlarge Method

Moved Method

RatioMove Method

ResetDimensions Method

ResetRestrictedControls Method

Resize Method

RestrictCtr Method

RestrictAll Method

Help file generated by VB HelpWriter.


Center Method

Centers a form in the middle of the screen.  An MDI child form will be centered in the middle of the MDI parent form.

Syntax

object.Center always

The Center method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

always	Optional. A boolean expression indicating whether this method should always affect the form as described in settings.

Settings

Value	Description

True	The Center method will change a form's dimensions even if the form has already had it's dimensions  saved.

False	The Center method will change a form's dimensions only if it has not yet had it's dimensions saved. Therefore a form which has been set to have it's dimensions saved will only be affected by the Center method the first time it is loaded. From then onwards it will only load with the position and dimensions where it was previously unloaded.

Remarks

The Center method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Tip	Generally it is best for this method to be applied in the form's Form_Load  event after the Form property has been set.

Help file generated by VB HelpWriter.


RatioMove Method

Moves a form to a required position and size in proportion to the screen. Dimensions of an MDI child form will be in proportion to the MDI parent form.

Syntax

object.RatioMove left, top, width, height, always

The RatioMove method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

left	Required. A numeric expression specifying the distance between the left edge of a form and the left edge of it's container as described in settings.

top	Optional. A numeric expression specifying the distance between the top edge of a form and the top edge of it's container as described in settings.

width	Optional. A numeric expression specifying the width of a form as described in settings.

height	Optional. A numeric expression specifying the height of a form as described in settings.

always	Optional. A boolean expression indicating whether this method should always affect the form as described in settings.

Settings

Part	Constant	Value	Description

left	gnORIG_LEFT	-1	Distance between the left edge of a form and the left edge of it's container remain unchanged

0 < left < 1	Distance in proportion to the form's container's internal width.

gnLEFT	0	Form will be positioned to the left hand side of it's container.

gnMIDDLE	1	Form will be positioned in the middle of it's container horizontally.

gnRIGHT	2	Form will be positioned to the right hand side of it's container.

top	0 < top < 1	Distance in proportion to the form's container's internal height.

gnLEFT	1	Form will be positioned in the middle of it's container vertically.

gnMIDDLE	1	Form will be positioned in the middle of it's container vertically.

gnBOTTOM	2	Form will be positioned to the bottom of it's container.

width	gnORIG	0	Form's width will revert back to it's original design-time size.

0 < width < 1	Form's width in proportion to the form's container's internal width.

height	gnORIG	0	Form's height will revert back to it's original design-time size.

0 < height < 1	Form's height in proportion to the form's container's internal width.

always	True	The RatioMove method will change a form's dimensions even if the form has already had it's dimensions  saved.

False	The RatioMove method will change a form's dimensions only if it has not yet had it's dimensions saved. Therefore a form which has been set to have it's dimensions saved will only be affected by the RatioMove method the first time it is loaded. From then onwards it will only load with the position and dimensions where it was previously unloaded.

Remarks

The RatioMove method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Tip	Generally it is best for this method to be applied in the form's Form_Load  event after the Form property has been set.

If you just want a form to be placed in the center of it's container it is simpler to use the  Center method.

Help file generated by VB HelpWriter.


ResetRestrictedControls Method

Pemanently resets all of the form's controls so that none of them are restricted.

Syntax

object.ResetRestrictedControls

The object placeholder is required and evaluates to an instance of the CClevRes class.

Remarks

Removes any restrictions which were applied to any of the form's controls using the RestrictCtr method. All the form's controls will immediately resize in proportion to the form's size.

Help file generated by VB HelpWriter.


ResetDimensions Method

Re-evaluates positions of each control on form relative to it's container.

Syntax

object.ResetDimensions

The object placeholder is required and evaluates to an instance of the CClevRes class.

Remarks

The ResetDimensions method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Controls which are moved (not by the CClevRes class), added or removed after the form has loaded will not automatically resize correctly. If the ResetDimensions method is applied it will enable these controls also to be resized correctly.

Tip	It is generally better to use the Added method and Moved method rather than the ResetDimensions method. Those methods are faster and the form's controls (which were not added or moved) remain in their correct positions with an ability to resize accurately.

Help file generated by VB HelpWriter.


Resize Method

Resizes controls on the form in proportion to the size of their respective containers.

Syntax

object.Resize control

The Resize method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

control	Optional. An object expression which evaluates to one of the controls on the form or the form itself.

Remarks

The Resize method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

If the control argument is omitted, all the controls on the form will resize in proportion to their respective containers. This will only occur if the size of the form has changed since the last time the Resize method was carried out. However, if the form itself is included as the control argument, all the controls will resize even if the form size was not changed since the last time the Resize method was applied.

When all controls on the form are resized, any controls which have been restricted by the RestrictCtr method will only resize in accordance with the respective restrictions imposed upon them.

If the control argument is included and evaluates to one of the controls on the form, only that control will be resized.

Tip	Generally it is best for this method to be applied in the form's Form_Resize event.

Help file generated by VB HelpWriter.


RestrictCtr Method

Restricts the resizability of a control.

Syntax

object.RestrictCtr control, restriction

The RestrictCtr method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

control	Required. An object expression which evaluates to one of the controls on the form.

restriction	Required. An integer which is the sum of values indicating the type of restrictions required to be imposed on the control. See settings for a list of restrictions and the values which they are representing.

Settings

Constant	Value	Description

gnRESIZABLE	0	Control should be fully resizable.

gnFIX_LEFT	1	Distance between the left edge of the control and the left edge of it's container should remain fixed.

gnFIX_TOP	2	Distance between the top edge of the control and the top edge of it's container should remain fixed.

gnFIX_RIGHT	4	Distance between the right edge of the control and the right edge of it's container should remain fixed.

gnFIX_BOTTOM	8	Distance between the bottom edge of the control and the bottom edge of it's container should remain fixed.

gnLARGEST_RESIZE	15	Distance between all the sides of the control and all the sides of it's container should remain fixed.

gnFIX_WIDTH	16	Width of the control should remain fixed.

gnFIX_HEIGHT	32	Height of the control should remain fixed.

 gnFIX_SIZE	48	Width and height of the control should remain fixed.

gnKEEP_OLD	64	New restrictions to the control should be in addition to any restrictions which that control had previously. If the same restrictions are applied to a control a second time there will be no change to that control's resizability.

Remarks

The RestrictCtr method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Any restriction applied to a control using the RestrictCtr method will cause that control to immediately resize with those restrictions. Whenever the Resize method is applied to the form by the CClevRes class after this time, any restricted controls will only resize to the extent that their restrictions will allow.

Tip	Generally it is best for this method to be applied in the form's Form_Load  event after the Form property has been set.

If a control is restricted to have one of it's sides a fixed distance from one of the sides of it's container, usually any control between that control and the side of the container which it is fixed to will need to be a fixed size. If the control in between remains resizable, the controls may collide with each other when the form is container.

If the Enlarge method has been applied to a control on the same container as the control, which the RestrictCtr method is now being applied to, is on, it is usually best to add 'gnKEEP_OLD' to the restriction being set.

Help file generated by VB HelpWriter.


Properties
Clever Resizer Properties

Methods

ChkRememberForm Property

Form Property

MaxFontSize Property

MDIForm Property

MinHeight Property

MinWidth Property

RememberForm Property

ShrinkFixedControls Property

Help file generated by VB HelpWriter.


ChkRememberForm Property

Sets the specified check box to act as a toggle for the form's Auto-Position feature.

Syntax

Set object.ChkRememberForm = checkbox

The ChkRememberForm property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

control	An object expression which evaluates to a check box which is on the form.

Remarks

After the ChkRememberForm property has been set to a check box on the form the user can toggle the form's ability to 'remember' it's dimensions. If the check box is checked when the form is unloaded, the form's position and size will be saved. The next time the form is loaded it will appear with those dimensions. If the check box is not checked, the form will load with the dimensions which were last saved for that form. It is not necessary for any code to be placed in the click event of that check box in order for the form's dimensions to be remembered.

If the form is being loaded for the first time (or before it has been set for it's dimensions to be remembered), it will open with it's design-time dimensions. If the Center method or RatioMove method have been applied to a form, it will open for the first time with the dimensions set by either of those methods.

Tip	Generally it is best for this property to be set in the form's Form_Load event after the Form property has been set.

The easiest way to provide a toggle for saving the form's dimensions is to place a check box anywhere on the form and name it - 'chkCRMemory'.

Help file generated by VB HelpWriter.


Form Property

Sets the form which this instance of the CClevRes class will act on.

Syntax

Set object.Form = form

The Form property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

form	An object expression which evaluates to a form.

Remarks

It is necessary for this property to be set before most other properties and methods can be set.  If the form which this instance of the CClevRes class will act on is an MDI child form, the Form property should only be set after the MDIForm property has been set

Setting the Form property automatically causes all the dimensions of the form's controls relative to their containers to be evaluated. Any time the Resize method is applied to the form afterwards, it's controls will be resized based on their positions at the time the Form property was set.

Setting the Form property for a form which has had it's dimensions saved, automatically causes those previously saved dimensions to be applied to the form.

Tip	If the form which this instance of the CClevRes class will act on is not an MDI child form, it is usually best for this property to be set at the beginning of the Form_Load event of that form. If it is an MDI child form, the MDIForm property should be set first. It is usually best for the MDIForm property to be set at the beginning of the MDI child's Form_Load event. Then the form should be resized to it's design-time width and height using the form's Width and Height properties. Only afterwards should the Form property be set.

Help file generated by VB HelpWriter.


MaxFontSize Property

Sets or returns the maximum font size of a control or form.

Syntax

object.MaxFontSize(control) [= value]

The MaxFontSize property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

control	An object expression which evaluates to one of the controls on the form or the form itself.

value	A number which indicates what the control's maximum font size should be as described in settings.

Settings

Constant	Value	Description

gnORIG	0	Control's original design-time font size will be it's maximum font size.

 gnNO_MAX	1	The control will have no maximum font size. It's font size will change in proportion to the size of the control. This is the initial default setting for all controls on the form.

value > 1	The actual value set or returned will be the control's maximum font size.

Remarks

The MaxFontSize property can only be used for an instance of the CClevRes class whos Form property has already been set. This property can then be set to affect that form.

Any maximum font size applied to a control using the MaxFontSize property will cause that control's font size to immediately conform if necessary. Whenever the Resize method is applied to the form by the CClevRes class after this time, the font size of a control which has had it's maximum font size set will only change to the extent that this property setting will allow.

If the control argument evaluates to the form, the maximum font size set will be the default maximum font size for any control which does not have it's own specific maximum font size set.

The font size of a resized control will only increase if both the width and height of the control increase enough to allow for a larger font size.

The ability for a control's font size to change is dependant on the particular font being used. A font which has a large variety of sizes will resize more appropriately than a font with only a few sizes.

Tip	Generally it is best for this property to be set in the form's Form_Load  event after the Form property has been set.

In order to take most advantage of the Auto-Font-Size feature, it is best to use fonts which have a large variety of sizes.

It is easy to provide a toggle for the form's default Auto-Font-Size setting. Place a check box anywhere on the form and name it - 'chkCRAutoFontSize'. The MaxFontSize property of this instance of the CClevRes class should should be set to the value of the check box in the chkCRAutoFontSize_Click() event.

Help file generated by VB HelpWriter.


MDIForm Property

Sets the parent MDI form of the child form which this instance of the CClevRes class is required to act on.

Syntax

Set object.MDIForm = form

The MDIForm property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

form	An object expression which evaluates to an MDI parent form.

Remarks

If the form which is required to be made dynamic is an MDI child form, it is necessary for the MDIForm property to be set. It is also necessary for this property to be set before most other properties and methods of the CClevRes class including the Form property.

Tip	It is usually best for the MDIForm property to be set at the beginning of the MDI child's Form_Load event, then the form should be resized to it's design-time width and height using the form's Width and Height properties. Only afterwards should the Form property be set.

Help file generated by VB HelpWriter.


MinHeight Property

Sets or returns the minimum height which a dynamic form can be reduced to.

Syntax

object.MinHeight [= value]

The MinHeight property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

value	A number which indicates what the form's minimum height should be as described in settings.

Settings

Value	Description

0 < value <= 10	Form's minimum height will be a fraction or multiple of it's design-time height, e.g if value = 0.5 the form's minimum height will be half it's original height, if value = 2 the form's minimum height will be twice it's original height.

10 < value	Form's minimum height will be the amount specified by value. This amount evaluates to a size in twips.

Remarks

The MinHeight property can only be used for an instance of the CClevRes class whos Form property has already been set. This property can then be set to affect that form.

The default minimum height for a form is it's original design-time height. If the minimum height is changed to be less than this value it is necessary to ensure that all controls have the ability to be reduced in size and that controls with text use fonts whos sizes can be reduced.

It is possible to change the default minimum height for a form by changing the value of fDEFAULT_MIN_SIZE in the General declarations of the CClevRes class.

Tip	To ensure that controls and text will resize correctly when the size of a dynamic form is reduced, it is generally safest to keep the minimum form size as the default design-time size or larger. If the user should be given the option to reduce the form to a small size, the form could be built from the beginning with those small dimensions.

Help file generated by VB HelpWriter.


MinWidth Property

Sets or returns the minimum width which a dynamic form can be reduced to.

Syntax

object.MinWidth [= value]

The MinWidth property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

value	A number which indicates what the form's minimum width should be as described in settings.

Settings

Value	Description

0 < value <= 10	Form's minimum width will be a fraction or multiple of it's design-time width, e.g if value = 0.5 the form's minimum width will be half it's original width, if value = 2 the form's minimum width will be twice it's original width.

10 < value	Form's minimum width will be the amount specified by value. This amount evaluates to a size in twips.

Remarks

The MinWidth property can only be used for an instance of the CClevRes class whos Form property has already been set. This property can then be set to affect that form.

The default minimum width for a form is it's original design-time width. If the minimum width is changed to be less than this value it is necessary to ensure that all controls have the ability to be reduced in size and that controls with text use fonts whos sizes can be reduced.

It is possible to change the default minimum width for a form by changing the value of fDEFAULT_MIN_SIZE in the General declarations of the CClevRes class.

Tip	To ensure that controls and text will resize correctly when the size of a dynamic form is reduced, it is generally safest to keep the minimum form size as the default design-time size or larger. If the user should be given the option to reduce the form to a small size, the form could be built from the beginning with those small dimensions.

Help file generated by VB HelpWriter.


RememberForm Property

Sets or returns a boolean expression indicating whether the form's Auto-Position ability is enabled or not.

Syntax

object.RememberForm [= value]

The RememberForm property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

value	A boolean expression indicating whether the form's dimensions should be remembered when the form is unloaded or not, as described in settings.

Settings

Value	Description

True	When the form is unloaded the form will have it's dimensions saved in the windows registry.

False	When the form is unloaded the form will not have it's dimensions saved.

Remarks

If RememberForm is set to False, the form will open next time with the last dimensions which were saved for that form. The Center method and RatioMove method can override this if their 'always' argument is set to True.

If the form is being loaded for the first time (or before it has been set for it's dimensions to be remembered), it will open with it's design-time dimensions. If the Center method or RatioMove method have been applied to a form, it will open for the first time with the dimensions set by either of those methods.

Tip	The easiest way to provide a toggle for saving the form's dimensions is to place a check box anywhere on the form and name it - 'chkCRMemory'.

Help file generated by VB HelpWriter.


ShrinkFixedControls Property

Sets or returns a boolean expression indicating whether restricted controls will shrink when the form is reduced to a size smaller than the form's original design-time size.

Syntax

object.ShrinkFixedControls [= value]

The ShrinkFixedControls property syntax has these parts:

Part	Description

object	An object expression that evaluates to an instance of the CClevRes class.

value	A boolean expression indicating whether fixed controls should be able to shrink in size or not.

Settings

Value	Description

True	When the form is reduced to be smaller than it's original design-time size, even restricted controls will shrink in size. This is the default setting.

False	When the form is reduced to be smaller than it's original design-time size, only unrestricted controls will shrink in size.

Remarks

If a form, which contains restricted controls, is allowed to be reduced to be smaller than it's original design-time size and the ShrinkFixedControls property is set to False, some of the form's properties may collide with each other.

Tip	It is generally best to keep the form's minimum size as the default design-time size or larger (see MinWidth property and MinHeight property). The usage of the ShrinkFixedControls property will then be superfluous.

Help file generated by VB HelpWriter.


RestrictAll Method

Restricts the resizability of all the controls on a particular container.

Syntax

object.RestrictAll control, restriction

The RestrictAll method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

control	Required. An object expression which evaluates to one of the containers on the form or the form itself.

restriction	Required. An integer which is the sum of values indicating the type of restrictions required to be imposed on the container's controls as described in settings.

Settings

Constant	Value	Description

gnRESIZABLE	0	Controls should be fully resizable.

gnFIX_LEFT	1	Distance between the left edge of the controls and the left edge of their container should remain fixed.

gnFIX_TOP	2	Distance between the top edge of the controls and the top edge of their container should remain fixed.

gnFIX_RIGHT	4	Distance between the right edge of the controls and the right edge of their container should remain fixed.

gnFIX_BOTTOM	8	Distance between the bottom edge of the controls and the bottom edge of their container should remain fixed.

gnLARGEST_RESIZE	15	Distance between all the sides of the controls and all the sides of their container should remain fixed.

gnFIX_WIDTH	16	Width of the controls should remain fixed.

gnFIX_HEIGHT	32	Height of the controls should remain fixed.

 gnFIX_SIZE	48	Width and height of the controls should remain fixed.

 gnKEEP_OLD	64	New restrictions to controls should be in addition to any restrictions which those controls had previously. If the same restrictions are applied to a control a second time there will be no change to that control's resizability.

Remarks

The RestrictAll method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Any restriction applied to controls using the RestrictAll method will cause those controls to immediately resize with those restrictions. Whenever the Resize method is applied to the form by the CClevRes class after this time, any restricted controls will only resize to the extent that their restrictions will allow.

If the control argument evaluates to the form, all the controls on the form will be restricted the same way.

Tip	Generally it is best for this method to be applied in the form's Form_Load  event after the Form property has been set.

If the controls on a container are fixed to one the container's sides, it is usually necessary for all the controls to have their size fixed aswell in order to avoid collisions.

If the Enlarge method has been applied to a control on a container which the RestrictAll method is now being applied to, it is usually best to add 'gnKEEP_OLD' to the restriction being set.

Help file generated by VB HelpWriter.


Enlarge Method

Sets one control to be able to enlarge as much as possible. Other controls on the same container become restricted in order to accomodate that one control.

Syntax

object.Enlarge control

The Enlarge method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

control	Required. An object expression which evaluates to one of the controls on the form.

Remarks

The Enlarge method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

By applying the Enlarge method to a control, it's sides will all be set to be a fixed distance from the respective sides of it's container. Any controls (on the same container) which are completely to the left of the enlarged control will be restricted to be fixed to the left-hand side of the container and have a fixed width. If these controls are not totally above the top of the enlarged control nor totally below it, then they will still be able to resize vertically. Similar restrictions occur to controls around the other three sides of the enlarged control.

It is possible to apply the Enlarge method to more than one control on a form. This method only affects controls which are on the same container as the control to be enlarged. Therefore different controls on different containers can be enlarged with this method. Also, if there are controls one on top of each other (for example, if there is a control array whereby each member of the array have the same Left, Top, Width and Height properties), it is possible to make them all enlarged even though they are all on the same container.

Note	The Enlarge method will override any previous restrictions applied to any controls which are on the same container as the control being enlarged. It is however possible to apply the Enlarge method to one of the controls and still restrict other controls in a way different to the restrictions imposed by the Enlarge method. The Enlarge method should be applied first. Then any controls which require their restrictions to be changed should be restricted using one of the other restriction methods. It is usually necessary for the new restrictions to be in addition (and not in place of) the restrictions imposed by the Enlarge method. This will ensure that the new restrictions will not cause the controls to collide with the enlarged control.

Any restriction applied to controls using the Enlarge method will cause those controls to immediately resize with those restrictions. Whenever the Resize method is applied to the form by the CClevRes class after this time, any restricted controls will only resize to the extent that their restrictions will allow.

Tip	Generally it is best for this method to be applied in the form's Form_Load  event after the Form property has been set.

When building a form which will use the Enlarge method, certain designs will take more advantage of this method.  Often it will be best to size most of the controls to the exact size which they are required to be. The control which will have the Enlarge method applied to it can in fact be positioned on the form much smaller than required. This will give the user a double benefit from the Enlarge method. When the enlargable control is being used, the form can be stretched to maximise that control. When other controls are being used, the user may appreciate the ability to make the form as small as possible.

Help file generated by VB HelpWriter.


Limitations

Which controls will Clever Resizer work for?

Clever Resizer is able to correctly resize and restrict even the following problematic controls:

•	SSTab

•	Line

•	DBCombo

•	DBList

•	RichTextBox

However, the following limitations have not yet been resolved:

•	SSTab - not possible to use the Enlarge method for a control on the SSTab.

Workaround: 	1) Restrict controls individually using RestrictCtr method

2) Place each tab's controls on a frame, then Enlarge method will work

•	DBList - does not  always display correctly when a resized form loads

Workaround: Use the Resize method for just that control after the Form_Load event is completed

•	Data - might not resize correctly if it is on a container other than the form. This is due to the data control not having a container property. Controls with no container property are treated as if the form is their container.  Therefore if both the data control and it's container have not been restricted by any of the restriction methods, then  the data control will resize correctly.

Workaround: 	If the data control needs to be restricted, place it directly on the form.

Any control which has Left, Top, Width, Height and Container properties would be expected to resize correctly.

Which controls can be passed as arguments for the different methods?

Each instance of the CClevRes class must have it's Form property set to the form which it is required to regulate. Any control on that form can be passed to the class when applying the methods which require, or have an option, for that method to act on a particular control. However, if the control is part of a control array each element of the array should be passed individually with it's index. If the name of the control array is passed to the method without an index, a helpful message will be displayed. An example of this limitaion would be in a case where a control array called MyImages has 6 elements. All the elements are required to have a fixed width and a fixed height. The following will not work:

CCRfrmMyForm.RestrictCtr MyImages, gnFIX_SIZE

It is necessary to write the following code:

For i = 0 To 5

CCRfrmMyForm.RestrictCtr MyImages(i), gnFIX_SIZE

Next

If the ClevRes wizard is used, it is sufficient to state the highest element in the control array and add an asterix (*) afterwards. The wizard will generate the necessary code to restrict all the controls in the array. In the above example, the wizard should first be to 'Customize' the resizability of the controls. Then the following should be added to the list of controls which will not completely resize in proportion to their containers:

MyImages(5)*

The wizard will generate the following code:

   Dim CtrIndex as Integer

   . . .

   For CtrIndex = 0 To 5

      CCRMyForm.RestrictCtr MyImages(CtrIndex), gnFIX_WIDTH + gnFIX_HEIGHT

   Next

Which scale modes will Clever Resizer work for?

Clever Resizer should correctly resize controls irrespective of their container's scale mode. However, controls may not resize correctly under the following conditions:

1) The scale mode was changed after the form was loaded.

2) The scale mode used is too large. '1 - Twips' is the best scale mode to use, '3 - Pixels' should also be acceptable.

Help file generated by VB HelpWriter.


Support

Bugs

Much effort has been taken to ensure that the Clever Resizer works for the controls which shipped with VB4 Professional version. If you encounter any problems please let me know.

3rd Party Controls

Unfortunately, it will not be possible for to promise any type of support for problems which arise from using  Clever Resizer with any 3rd party controls. However, if anyone encounters any problems and finds a workaround, please let me know so that this information could be passed on to other registered users.

Please note that there is one subroutine in the CClevRes class called 'ProblemCtrs' which deals with some controls which do not display as expected. If you have any problems with 3rd party controls that may be the place to deal with them.

Suggestions

If there are any features which you would like to see in future versions of  Clever Resizer please let me know.

Correspondence

You can reach me at the following address:

Eli Cohen

100320,3362@compuserve.com

To ensure a speedy reply please enter one of the following as the subject for the e-mail:

CClevRes Bug

CClevRes 3rd Party

CClevRes Suggestion

CClevRes Other

Help file generated by VB HelpWriter.


Registration

You can register Clever Resizer for just $20. As a bonus you will receive for FREE the ClevRes Wizard which you will be allowed to use to quickly make your forms dynamic. You can register Clever Resizer on Compuserve, just GO SWREG. The registration ID for Clever Resizer is:

14151

After registering, the CClevRes class will be sent to you by e-mail. You will then have not only the functuality of Clever Resizer, but the actual class as pure commented VB code!

Help file generated by VB HelpWriter.


Added Method

Saves the dimensions of a new control which has been added to the form after the form was loaded.

Syntax

object.Added control

The Added method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

control	Optional. An object expression which evaluates to a control on the form which was added to the form using the VB Load statement after the form was loaded.

Remarks

The Added method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Note	There is a case when the Added method may not work accurately. This occurs for a control which was added to a container whose size has been restricted in some way by one of the restriction methods. However, if the control was added to the form, a fully resizable container or even onto a restricted container and the form is still it's original size, the Added method should work accurately.

Tip	Generally it is best for this method to be applied immediately after adding a control to the form with the Load Statement.

Help file generated by VB HelpWriter.


Moved Method

Saves the dimensions of a control which has been moved (not by the CClevRes class) .

Syntax

object.Moved control

The Moved method syntax has these parts:

Part	Description

object	Required. An object expression that evaluates to an instance of the CClevRes class.

control	Optional. An object expression which evaluates to a control on the form which has been moved (not by the CClevRes class).

Remarks

The Moved method can only be used for an instance of the CClevRes class whos Form property has already been set. This method will then act on that form.

Note	There is a case when the Moved method may not work accurately. This occurs for a control which was moved on a container whose size has been restricted in some way by one of the restriction methods. However, if the control was moved on the form, a fully resizable container or even on a restricted container and the form is still it's original size, the Moved method should work accurately.

Tip	Generally it is best for this method to be applied immediately after moving a control on the form.

Help file generated by VB HelpWriter.


Restriction Methods

There are three methods which restrict controls' resizability in some way:

Enlarge Method

RestrictCtr Method

RestrictAll Method


ClevRes wizard

Wizard that generates the VB code which you need to add to your forms in order to make them dynamic. In minutes you can make your forms dynamic exactly the way your users would like them to be.


Setup

How To Make Your Forms Dynamic

1. Copy the following files to your project folder:

•	CClevRes.cls

•	MClevRes.bas

•	modCRLtd.bas

2. Add these modules to your project (using Add File from the File menu)

3. Run the CClevRes Wizard and just follow the steps.

Making Your Final EXE

When you are ready to make your final EXE you can reduce the amount of code that will be compiled. Some error handling code has been included just for the programmer's benifit during design time (See Helpful Messages in Overview). It is not necessary for this code to be included in your final EXE file. Before making your final EXE you can do the following:

1. Change the first line of  General Declarations in the CClevRes class to:

 #Const gbDebug = False

2. Remove module modCRLtd.bas from your project (use Remove File from the File menu)

Help file generated by VB HelpWriter.


dimensions  saved
Saving Form's Position and Size

When a form is unloaded it is possible for it's position and size to be saved. The next time it is loaded it will de displayed at the same position and the same size as it was previously. There are three ways of achieving this:

1.	Place a check box anywhere on the form and set it's Name to 'chkCRMemory'. Without any coding it will be moved to have a restricted position in the top right-hand corner of the form. If the box has been checked when the form is unloaded, the form's dimensions will be saved automatically.

2.	Set the ChkRememberForm property to one of the checkboxes on the form.

3.	Set the RememberForm Property to True.


Copyright

1) An unregistered version of the CClevRes class, the ClevRes Wizard and the ClevRes help files may not be used in any way other than for demonstrational purposes to see if you would be interested in registering.

2) You may distribute copies of the unregistered demonstration of Clever Resizer on the condition that all the accompanying files are distributed together including these help files with this copyright notice.

3) You may not rent, lease or distribute in any way either a registered or an unregistered version of the CClevRes class source code.

4) After registering Clever Resizer you will not be allowed to sell, rent, lease or distribute any other type of resizing class, control or device made from any part of the CClevRes class, whose function is to resize controls, restrict controls' resizability, position forms or remember form's positions.

5) None of the CClevRes source code may be used, either partially or as a whole, by anyone who does not own a registered version of the CClevRes class.

5) After registering Clever Resizer you will be granted the limited right to use it royalty free in any of your applications. You may only make copies of it in order to include it in your applications or for backup purposes. It is your responsibility to ensure that nobody violates any of these copyright rules by copying or using any of your copies of the CClevRes class.

6) If you are part of a programming team each programmer using Clever Resizer is required to have their own registered copy of the CClevRes class.

Limitation of Liability

The author will not be held responsible for any damages arising from usage of the software.

Disclaimer

This software is provided "as is".

Copyright © 1997 Eli Cohen. All rights reseved.

Help file generated by VB HelpWriter.


Glossary

A

Auto-Font-Size

Auto-Position

C

CClevRes 3rd Party

CClevRes Bug

CClevRes Other

CClevRes Suggestion

CClevRes.cls

Clever Resizer

ClevRes Wizard

Customized Controls

E

Enlarged Steps!

Enlarged Text Box!

H

Help!

helpful message

Helpful Messages

M

Max & Min!

maximum font size

MClevRes.bas

Memory!

modCRLtd.bas

More!

P

Position

R

Resizability

Resizable!

restricted position

Restricts the resizability

S

Speed!

T

Toggle Font Size!

Toggle Help!

Toggle Memory!


Auto-Font-Size

Ability for a control's font size to automatically resize in proportion to the size of the control.


Auto-Position

Ability for a form to save it's position and size when it is unloaded. When it is next loaded it will appear with those previously saved dimensions.


CClevRes 3rd Party

A letter relating to using Clever Resizer with 3rd party controls


CClevRes Bug

A letter explaining about a bug found in Clever Resizer


CClevRes Other

Any other comments related to Clever Resizer


CClevRes Suggestion

Any suggestions for future versions of Clever Resizer


CClevRes.cls

This is the Clever Resizer class which will make your form dynamic


Clever Resizer

CClevRes Class to enhance any form to be dynamic, have a memory and more.


ClevRes Wizard

Wizard that generates the VB code which you need to add to your forms in order to make them dynamic. In minutes you can make your forms dynamic exactly the way your users would like them to be.


Customized Controls

Ability to specify which controls should not resize completely in proportion to the size of the containers which they are on. Instead they can be set to have a fixed position, size or both.


Enlarged Steps!

When you enlarge the wizard the different steps of the wizard enlarge to their maximum!


Enlarged Text Box!

The text box which you need to enlarge the most does so!


Help!

A short description of each aspect of the wizard is given in a status bar!


helpful message

Useful messages which explains to you the programmer why the Clever Resizer is not able to do what you have programmed it to do. A possible solution is usually suggested.


Helpful Messages

Useful messages which explains to you the programmer why the Clever Resizer is not able to do what you have programmed it to do. A possible solution is usually suggested.


Max & Min!

While experimenting with making a form dynamic you may want this wizard maximized or minimized!


maximum font size

The font size of a control can be regulated as to how it will change when the control is resized.


MClevRes.bas

This module contains the global constants used by the CClevRes class


Memory!

Move and size the wizard once and it will always open where you want it, the size you want it!


modCRLtd.bas

This module contains the Helpful Messages which will be displayed during design time if the CClevRes class is programmed in a way which it is not equiped for


More!

Just try it! ... You'll enjoy making your forms dynamic!


Position

Control over the initial position and size of a form when it is loaded.


Resizability

Ability for each control on a form to resize in proportion to the size of the container which it is on.


Resizable!

Enables you to position and size the wizard to suit your own personal requirements!


restricted position

Check boxes to act as toggle for the form's memory and toggle for the default maximum font size have their positions restricted. Even if ResetRestrictedControls method or RestrictAll Method is applied to all the controls on the form, these check boxes will remain in their original restricted positions.


Restricts the resizability

A control which is restricted will not fully resize in proportion to the size of it's container when the Resize method is later applied.


Speed!

In minutes you can add a lot more control to your controls!


Toggle Font Size!

Quickly switch between original and maximum font size!


Toggle Help!

After a little experience you may want to switch the help off!


Toggle Memory!

When you do not want wizards' size and position saved just switch 'Memory' off!