Results 1 to 7 of 7

Thread: Auto aligning controls

  1. #1

    Thread Starter
    Lively Member anycoder's Avatar
    Join Date
    Jan 2025
    Posts
    68

    Auto aligning controls

    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.
    Attached Files Attached Files

  2. #2
    Fanatic Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    633

    Re: Auto aligning controls

    very good job, works pretty well

  3. #3
    Addicted Member
    Join Date
    Oct 2014
    Posts
    131

    Re: Auto aligning controls

    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!

  4. #4

    Thread Starter
    Lively Member anycoder's Avatar
    Join Date
    Jan 2025
    Posts
    68

    Re: Auto aligning controls

    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.

    Try this version adapted for pixel scale mode
    Attached Files Attached Files

  5. #5
    Addicted Member
    Join Date
    Oct 2014
    Posts
    131

    Re: Auto aligning controls

    Hello AnyCoder!
    Thank you very much for your contribution.
    Thanks for the quick help, the sample works fine in pixel mode, which is a very useful feature.
    There is a very strange problem, using "https://www.oaltd.co.uk/indenter/", https://www.oaltd.co.uk/DLCount/DLCo...ndenterVB6.exe,

    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!

    Thank you very much!

    Pixel ScaleMode_VBCItem_Indenter.zip

    Name:  A.jpg
Views: 1143
Size:  42.7 KB

    Name:  B.jpg
Views: 1086
Size:  34.4 KB

  6. #6

    Thread Starter
    Lively Member anycoder's Avatar
    Join Date
    Jan 2025
    Posts
    68

    Re: Auto aligning controls

    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.

  7. #7
    Addicted Member
    Join Date
    Oct 2014
    Posts
    131

    Re: Auto aligning controls

    Hello! AnyCoder?
    Thank you so much for your quick and helpful help, your reply was quick, effective and accurate to resolve the issue.

    Thank you so much for helping me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width