This utility to automatically align controls, the client area is divided into 5 regions cTop, cBottom, cLeft, cRight the rest determines the cClient space. The alignment is done in relation to the Container, only the controls having the positioning properties Top, Left, Width, Height and Container are concerned, it's possible to add a Splitter to resize the control, the Splitter is a Frame its position depends on the type of alignment only cTop, cLeft, cBottom, cRight are supported.
Hello AnyCoder!
Thank you very much for your contribution.
It works very well in "Me.ScaleMode=Twip", but in the "Me.ScaleMode = Pixel" is not working properly.
In design development, the "ScaleMode = Pixel" pattern is often used.
Please help to optimize the functionality to be compatible with both "ScaleMode=Twip" and "ScaleMode=Pixel".
Thank you very much!
yokesee, smileyoufu
Thanks for your reaction and encouragement.
It works very well in "Me.ScaleMode=Twip", but in the "Me.ScaleMode = Pixel" is not working properly.
Initially the code was developed under VBA which works in point ScaleMode, some features were removed like automatic scrollbars which not supported in vb6 for Forms and Frames.
After indenting the module code format in "VBCItem.cls", the bottom control is laid out out out of order (there is no problem with the indentation of the code in other modules).
I've compared the code and haven't found the cause of the problem, but once I run it, the bottom control is problematic.
My solution now is to make "VBCItem.cls" read-only to avoid any more problems.
If possible, please help analyze the cause of the error, thank you!
After comparing the physical files CtrlAlign.cls, I found that DispID attributes were added to some members to bind them to the base properties with the corresponding name.,.just delete them.
Code:
Attribute SplitterEvent.VB_VarUserMemId = 1073938445
Attribute SplitterEvent.VB_VarHelpID = -1
Public OrgLeft As Single, OrgTop As Single
Attribute OrgTop.VB_VarUserMemId = 1073938439
Public OrgWidth As Single, OrgHeight As Single
Attribute OrgWidth.VB_VarUserMemId = 1073938441
Attribute OrgHeight.VB_VarUserMemId = 1073938441
Public Owner As CAlignCls
Attribute Owner.VB_VarUserMemId = 1073938443
Public Parent As VBCItem
Attribute Parent.VB_VarUserMemId = 1073938444
Last edited by anycoder; Apr 12th, 2025 at 11:17 AM.