Skip to content

Planet-Source-Code/jamesjd-center-forms-without-errors-when-maximized__1-48023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

[ Center Forms Without Errors When Maximized ]

Description

This will center forms and when you maximize the form the Command Button which you click to re-center it will be disabled.

More Info

You will need: One Command Button (you just need to keep there default names)

Submitted On
By JamesJD
Level Beginner
User Rating 4.0 (8 globes from 2 users)
Compatibility VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Category Custom Controls/ Forms/ Menus
World Visual Basic
Archive File

Source Code

Private Sub Command1_Click()
If Form1.WindowState = 0 Then
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Form1.Top = Screen.Height / 2 - Form1.Height / 2
Else
Command1.Enabled = False
End If
End Sub
Private Sub Form_Load()
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Form1.Top = Screen.Height / 2 - Form1.Height / 2
End Sub
Private Sub Form_Resize()
If Form1.WindowState = 2 Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published