Custom border ...
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
Ok so ....
If you want to create a for example "STAR" to be your forms border you have to do the following ;))
Open up new project and set the following settings of your form :
-Border style - None
-Transparency key - Yellow !
When you set that, enter this in the "Form1.vb" - codes
So when you have that, you can now move your form with NO BORDER STYLE by just dragging it (with mouse click held down) ....
Now open up MS PAINT and create a "STAR" like this !!!
[img]http://www.freeimagehosting.net/uploads/a8ee94ed63.png[/img]
but be careful ... THE COLOR MUST BE SOLID !!!!
You can also download this picture for trying this
Now set the Forms Background image to this image ...
And add a button named Button1, double click on it and add the following :
The button should be inside the star ....
NOTE : "THE STAR IS NOW YOUR "FORM" , ALL THAT WILL BE SEEN HAS TO BE INSIDE THE STAR !!! "
If you want to create a for example "STAR" to be your forms border you have to do the following ;))
Open up new project and set the following settings of your form :
-Border style - None
-Transparency key - Yellow !
When you set that, enter this in the "Form1.vb" - codes
Code: Select all
This is what to do when the mouse is moved ... !!!Public class Form1
Private IsFormBeingDragged As Boolean = False
Private MouseDownX As Integer
Private MouseDownY As Integer[code]
Ok, so this is to get mouse position X - left/right and for Y position - Up/Down and variable to check
if you are moving the mouse while you are holding your click - "mouse down"
[code]
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
IsFormBeingDragged = True
MouseDownX = e.X
MouseDownY = e.Y
End If
End Sub[code]
This is to check if the mouse is clicked ... if it is : "IsFormBeingDragged = True" - that means that the form moves if mouse is clicked and moved ...
[code]Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Left Then
IsFormBeingDragged = False
End If
End Sub[code]
This is to "disable" FormDragging .... - When the mouse click is released ....
[code]Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
If IsFormBeingDragged Then
Dim temp As Point = New Point()
temp.X = Me.Location.X + (e.X - MouseDownX)
temp.Y = Me.Location.Y + (e.Y - MouseDownY)
Me.Location = temp
temp = Nothing
End If
End Sub
End class
So when you have that, you can now move your form with NO BORDER STYLE by just dragging it (with mouse click held down) ....
Now open up MS PAINT and create a "STAR" like this !!!
[img]http://www.freeimagehosting.net/uploads/a8ee94ed63.png[/img]
but be careful ... THE COLOR MUST BE SOLID !!!!
You can also download this picture for trying this

Now set the Forms Background image to this image ...
And add a button named Button1, double click on it and add the following :
The button should be inside the star ....
Code: Select all
Press F5 to debug it and test it out ...MsgBox("Hello world !!!")
NOTE : "THE STAR IS NOW YOUR "FORM" , ALL THAT WILL BE SEEN HAS TO BE INSIDE THE STAR !!! "
Last edited by M1z23R on Tue Sep 28, 2010 6:29 pm, edited 1 time in total.
this is to easy + i saw this code on another website
give a credit if this isn't yours
give a credit if this isn't yours
Hello and welcome to CodenStuff
What you could do is explain the code and you will get great comments cooll;
always remember to give credits to original author.
What you could do is explain the code and you will get great comments cooll;
always remember to give credits to original author.
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
Ok thank you for your advise ... But the code is all mine
Honestly ... ;)

nope i rly saw EXACTLY the same code with "temp" and such
Hello M1z23R,
I gotta say this:
This has been posted really often here(moving borderless windows)
I gotta say this:
This has been posted really often here(moving borderless windows)
This tutorial is about creating custom border, not "moving form without border" ....
M1z23R wrote:This tutorial is about creating custom border, not "moving form without border" ....Well still there are few of these
M1z23R wrote:This tutorial is about creating custom border, not "moving form without border" ....
Code: Select all
3/4th of your code tells a different story Private IsFormBeingDragged As Boolean = False
Private MouseDownX As Integer
Private MouseDownY As Integer[code]
Ok, so this is to get mouse position X - left/right and for Y position - Up/Down and variable to check
if you are moving the mouse while you are holding your click - "mouse down"
[code]
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
IsFormBeingDragged = True
MouseDownX = e.X
MouseDownY = e.Y
End If
End Sub[code]
This is to check if the mouse is clicked ... if it is : "IsFormBeingDragged = True" - that means that the form moves if mouse is clicked and moved ...
[code]Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Left Then
IsFormBeingDragged = False
End If
End Sub[code]
This is to "disable" FormDragging .... - When the mouse click is released ....
[code]Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
If IsFormBeingDragged Then
Dim temp As Point = New Point()
temp.X = Me.Location.X + (e.X - MouseDownX)
temp.Y = Me.Location.Y + (e.Y - MouseDownY)
Me.Location = temp
temp = Nothing
End If
End Sub
Copyright Information
Copyright © Codenstuff.com 2020 - 2023