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

Handling the SysInfo Control

You can use the SysInfo control, distributed with VB5 and VB6, to write applications that can sport the Windows logo and that can behave intelligently when a system setting changes. The control fires the DisplayChanged event when the screen resolution changes, and it fires the SysColorChange event when the user modifies one or more system colors in the Control Panel.

For example, when you have a maximized form and the user switches to a higher screen resolution, VB correctly resizes the form to occupy a larger screen area. However, when the user switches to a lower resolution, VB doesn't resize the form accordingly. This code does the trick:

 
Private Sub SysInfo1_DisplayChanged()
	' If the form is maximized, restore it and
	' maximize it again
	With Me
		If .WindowState = vbMaximized Then
			.Visible = False
			.WindowState = vbNormal
			.WindowState = vbMaximized
			.Visible = True
		End If
	End With
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