Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Apr 8, 1999

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()
	MoveForm
End Sub

' this form is 1000 twips tall, and is located 
' near the bottom border of the workarea
Sub MoveForm()
	With SysInfo1
		Me.Move .WorkAreaLeft, _
			.WorkAreaTop + .WorkAreaHeight _
			- 1000, .WorkAreaWidth, 1000
	End With
End 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 If
End Sub
For more information on this topic, look on VB's Help file under "SysInfo."
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date