window possition on screeen
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts
Page 1 of 1
:mrgreen: can u make a demo showin how to possition a window at diff places on the screen please mate like ur shortcut bar thing where its at side n stuff
cheers mate n wicked site
cheers mate n wicked site
Hello billyboy
Yes I can do that for you. If you create a new project and add 6 buttons to your form. Aslong as the buttons are in the correct orde then you can just copy and paste the following code. This code assumes that your buttons are in the following order:
Button1 Button2 Button3
Button4 Button5 Button6
Button7 Button8 Button9
Then copy this code into your project:
You can also download the source from the link below.
Hope that helps
Yes I can do that for you. If you create a new project and add 6 buttons to your form. Aslong as the buttons are in the correct orde then you can just copy and paste the following code. This code assumes that your buttons are in the following order:
Button1 Button2 Button3
Button4 Button5 Button6
Button7 Button8 Button9
Then copy this code into your project:
Code: Select all
I have quoted each button so you know which button positions the window in the different locations on screenPublic Class Form1
'TOP CENTER OF THE SCREEN
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.CenterToScreen()
Me.Top = Screen.PrimaryScreen.Bounds.X
End Sub
'LEFT CENTER OF THE SCREEN
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.CenterToScreen()
Me.Left = Screen.PrimaryScreen.Bounds.Y
End Sub
'RIGHT CENTER OF THE SCREEN
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.CenterToScreen()
Me.Left = Screen.PrimaryScreen.Bounds.Width - Me.Width
End Sub
'BOTTOM CENTER OF THE SCREEN
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Me.CenterToScreen()
Me.Top = Screen.PrimaryScreen.WorkingArea.Height - Me.Height
End Sub
'TOP LEFT OF THE SCREEN
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Top = Screen.PrimaryScreen.Bounds.Y
Me.Left = Screen.PrimaryScreen.Bounds.Y
End Sub
'BOTTOM LEFT OF THE SCREEN
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Me.Top = Screen.PrimaryScreen.WorkingArea.Height - Me.Height
Me.Left = Screen.PrimaryScreen.Bounds.X
End Sub
'TOP RIGHT OF THE SCREEN
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Top = Screen.PrimaryScreen.Bounds.Y
Me.Left = Screen.PrimaryScreen.Bounds.Width - Me.Width
End Sub
'BOTTOM RIGHT OF THE SCREEN
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Me.Top = Screen.PrimaryScreen.WorkingArea.Height - Me.Height
Me.Left = Screen.PrimaryScreen.Bounds.Width - Me.Width
End Sub
'CENTER OF THE SCREEN
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.CenterToScreen()
End Sub
End Class
You can also download the source from the link below.
Hope that helps
You do not have the required permissions to view the files attached to this post.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
wicked u rock dude cheers mate 5/5* ur tutorials r the best every other place i go to get help they all talk technical jibberish n is hard to understand but u make it easy for me u well rock
jus one more thing mate can u show me how to make a window shake when click on it plz
Hello billyboy,
Erm the only way that I know of is like this. Add a timer to your project and use the following code in it, it makes the form window shake.
Code for Timer:
Erm the only way that I know of is like this. Add a timer to your project and use the following code in it, it makes the form window shake.
Code for Timer:
Code: Select all
And then to make it start and stop shaking you could add a button to your from and use this code:Public shake As Integer = 0
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Select Case shake
Case 0
Me.Location = New Point(Me.Location.X + 10, Me.Location.Y)
Exit Select
Case 1
Me.Location = New Point(Me.Location.X, Me.Location.Y + 10)
Exit Select
Case 2
Me.Location = New Point(Me.Location.X - 10, Me.Location.Y)
Exit Select
Case 3
Me.Location = New Point(Me.Location.X, Me.Location.Y - 10)
Exit Select
End Select
shake += 1
shake = shake Mod 4
End Sub
Code: Select all
Hope thats what you wanted, ive never really needed to make a form shake but thats the only way I know how to do it.If Timer1.Enabled = False Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023