Handling the SysInfo Control

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 WithEnd Sub

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


Share the Post: