Automatic repositioning/resizing of any control on your resizeable form

Environment VB6

Here are 2 easy-to-use vb classes, which enables automatic repositioning/sizing of any control on you resizeable vb-form.

Screen-Shot1

Screen-shot 2



How to use clsAutopositioner:

  1. Add clsAutopositioner.cls and clsAutoPositionerItem.cls to your vb-project
  2. Generate a Instance of clsAutopositioner on your form's load
  3. Attach any control to this object
  4. Call the Resize-Method of clsAutoPositioner on the form_resize event.

Example to generate some resizeable / fixed delta - controls:


private Sub Form_Load()
' Always relative to container's right border
  m_oAutoPos.AddAssignment me.Command1, me, _
    tCONTAINER_RELATIVE_POS_RIGHT
' Auto resizing horizontally
  m_oAutoPos.AddAssignment me.Command2, me, _
    tCONTAINER_WIDTH_DELTA_RIGHT
' Auto resizing vertically
  m_oAutoPos.AddAssignment me.Command3, me, _
    tCONTAINER_HEIGHT_DELTA_BOTTOM
' Always relative to container's bottom border
  m_oAutoPos.AddAssignment me.Command4, me, _
    tCONTAINER_RELATIVE_POS_BOTTOM
' Auto resizing horizontally + Auto resizing vertically
  m_oAutoPos.AddAssignment me.Command5, me, _
    tCONTAINER_WIDTH_DELTA_RIGHT
  m_oAutoPos.AddAssignment me.Command5, me, _
    tCONTAINER_HEIGHT_DELTA_BOTTOM
'
End Sub
'
private Sub Form_Resize()
  m_oAutoPos.RefreshPositions
End Sub
'
'

If you enjoy this control send me an email.

Download zipped control and sample project files



Comments

  • thats excellent

    Posted by shafaqat.khan on 10/14/2004 01:06pm

    hi, I just went thru the form and i must say it is excellent, can u help me with my form, Iam working on this form and would like to set up vertical/horizontal scrollbars on the form, also need to set up the form in such a way that it responds to changes in the screen resolution. Iam working on this form for a professor. Please send me a test mail so that i could send the form to u. (shafaqat_grey@yahoo.com) Any help from you would be greatly appreciated. Ali shafaqat_grey@yahoo.com

    Reply
  • Automatic repositioning/resizing of any control on your resizeable form

    Posted by Legacy on 08/27/2003 12:00am

    Originally posted by: Mani

    Great for standard forms, not too great for MDI forms!!!

    Reply
  • Zoom In and Out

    Posted by Legacy on 01/23/2003 12:00am

    Originally posted by: Sofiana H.T

    Can I use this code to zoom in and zoom out the picture

    Reply
  • Very good but some flexibility should be there

    Posted by Legacy on 06/15/2002 12:00am

    Originally posted by: Ashish Sheth

    The code is very good and It helps everybody who wants to resize the controls on the form as the form resize. But what if somebody wants to resize the control only a percentage of the form. This flexibility should be there. Otherwise everything is very fine.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • With JRebel, developers get to see their code changes immediately, fine-tune their code with incremental changes, debug, explore and deploy their code with ease (both locally and remotely), and ultimately spend more time coding instead of waiting for the dreaded application redeploy to finish. Every time a developer tests a code change it takes minutes to build and deploy the application. JRebel keeps the app server running at all times, so testing is instantaneous and interactive.

  • Live Event Date: April 22, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Database professionals — whether developers or DBAs — can often save valuable time by learning to get the most from their new or existing productivity tools. Whether you're responsible for managing database projects, performing database health checks and reporting, analyzing code, or measuring software engineering metrics, it's likely you're not taking advantage of some of the lesser-known features of Toad from Dell. Attend this live …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds