devxlogo

Take Taskbar Into Account When Resizing Forms

Take Taskbar Into Account When Resizing Forms

The SysInfo control lets you resize your forms to take any taskbar into account. For example, you might want to move and resize your form so it always appears at the bottom of the work area-that is, the area not taken by the Windows or Office taskbar or any other taskbar currently visible:

 Private Sub Form_Load()	MoveFormEnd Sub' this form is 1000 twips tall, and is located ' near the bottom border of the workareaSub MoveForm()	With SysInfo1		Me.Move .WorkAreaLeft, _			.WorkAreaTop + .WorkAreaHeight _			- 1000, .WorkAreaWidth, 1000	End WithEnd Sub

To move and resize the form automatically when the user moves the taskbars, creates new taskbars, or hides them, you have to trap the SysInfo control’s SettingChanged event:

 Private Sub SysInfo1_SettingChanged(ByVal Item As Integer)	Const SPI_SETWORKAREA = 47	If Item = SPI_SETWORKAREA Then		MoveForm	End IfEnd Sub

For more information on this topic, look on VB’s Help file under “SysInfo.”

See also  What Are International Payments, And How Do They Work?
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist