Custom "Skin" for your forms
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.
Hello,
A few of you seem to be asking how to make a form with round edges and skin/theme and I think I have made a tutorial about this somewhere I cant seem to find it :? . I decided to write another one and explain how its done.
The first thing you need to do is open up our chosen paint software (I use microsoft paint as my choice) and start a new image. Your image dimensions need to be the same size as your form so make sure you set its size before you get started.
Then you get to work on creating our forms custom skin and for this example I just draw some basic shapes to show you: Once you are happy with your design you need to choose a color that will become transparent when your application is run. I always use the color purple and have done so for this example. Once you have chosen your transparent color use it to fill in the areas of your skin that you dont want to show up when you run your application:
Now go into VB and change the followin properties on your form:
TransparencyKey - Change this to your transparent color (In my case I change it to purple)
FormBorderStyle - Change this to "None"
BackgroundImage - Change this to the skin you have just created.
Size - Make sure this is the same size as you skin
Thats the hard part done and we now move onto the code that will let you move your form.
Underneath "Public Class Form" add this code:
Thats it your finished!!
You can do different designs of almost anything you want like one with round edges: Or even a weird splatter shaped form:
These are the project files for this tutorial
Download: Happy coding! cooll;
A few of you seem to be asking how to make a form with round edges and skin/theme and I think I have made a tutorial about this somewhere I cant seem to find it :? . I decided to write another one and explain how its done.
The first thing you need to do is open up our chosen paint software (I use microsoft paint as my choice) and start a new image. Your image dimensions need to be the same size as your form so make sure you set its size before you get started.
Then you get to work on creating our forms custom skin and for this example I just draw some basic shapes to show you: Once you are happy with your design you need to choose a color that will become transparent when your application is run. I always use the color purple and have done so for this example. Once you have chosen your transparent color use it to fill in the areas of your skin that you dont want to show up when you run your application:
Now go into VB and change the followin properties on your form:
TransparencyKey - Change this to your transparent color (In my case I change it to purple)
FormBorderStyle - Change this to "None"
BackgroundImage - Change this to the skin you have just created.
Size - Make sure this is the same size as you skin
Thats the hard part done and we now move onto the code that will let you move your form.
Underneath "Public Class Form" add this code:
Code: Select all
Then in the "Form_MouseDown" event add this code:Public Const WM_NCLBUTTONDOWN As Integer = &HA1
Public Const HTCAPTION As Integer = &H2
<Runtime.InteropServices.DllImport("User32.dll")> _
Public Shared Function ReleaseCapture() As Boolean
End Function
<Runtime.InteropServices.DllImport("User32.dll")> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
Code: Select all
Build and run your project to see the results. If you did it all correctly then when you run your application it should look something like this:If e.Button = MouseButtons.Left Then
ReleaseCapture()
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
Thats it your finished!!
You can do different designs of almost anything you want like one with round edges: Or even a weird splatter shaped form:
These are the project files for this tutorial
Download: Happy coding! cooll;
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.
WOW ! THank you very much ! I love this !
You are the best ! Woohoo Codenstuff rocks!!!!!!!
You are the best ! Woohoo Codenstuff rocks!!!!!!!
I try it but it still show a little bit purple , how can i remove that?
Yes, its a mistery, everytime you use that method, on the borders, you can see a line of your background color.
wow that is realli good. I GUESS NOW can make a templte so i ca use tht
All I do is add a skin or picture, make it the same size and done :P
Hello,
Sometimes it still shows part of the transparent color on the edges I dont know why, mainly happens on curves.
Sometimes it still shows part of the transparent color on the edges I dont know why, mainly happens on curves.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Hello TVS Praveen!
It is just great! I wonder how people like Hungryhounduk (and you too) make designs like this? But whatever I say, this is wonderful!
Thanks for sharing!
It is just great! I wonder how people like Hungryhounduk (and you too) make designs like this? But whatever I say, this is wonderful!
Thanks for sharing!
Copyright Information
Copyright © Codenstuff.com 2020 - 2023