Transparent form

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.
6 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Transparent form
Dummy1912
Hello,

seems all know how to make a Transparent Form
yea sure we do :) but why using the Transparencykey to set your form into

now you can even use a easier way:

what do we need:
A Form

how it works:
important message: Do never ever ever set your form show in taskbar because this code will not work trust me i know ;)

double click on the form
so we get the sub load
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles  MyBase.Load
           FormBorderStyle = Windows.Forms.FormBorderStyle.None
           Me.ShowInTaskbar = False
           Me.ShowIcon = False
Try
            Me.BackColor = Color.Black
            Dim margins As MARGINS = New MARGINS
            margins.LeftWidth = -1
            margins.RightWidth = -1
            margins.TopHeight = -1
            margins.Buttomheight = -1
            Dim result As Integer = DwmExtendFrameIntoClientArea(Me.Handle, margins)
        Catch ex As Exception 'will be used if this above code does not work
            TransparencyKey = BackColor
        End Try
End Sub
or you can also use the sub new
Code: Select all
Public Sub New()
 InitializeComponent()
            FormBorderStyle = Windows.Forms.FormBorderStyle.None
            Me.ShowInTaskbar = False
            Me.ShowIcon = False
Try
            Me.BackColor = Color.Black
            Dim margins As MARGINS = New MARGINS
            margins.LeftWidth = -1
            margins.RightWidth = -1
            margins.TopHeight = -1
            margins.Buttomheight = -1
            Dim result As Integer = DwmExtendFrameIntoClientArea(Me.Handle, margins)
        Catch ex As Exception 'will be used if this above code does not work
            TransparencyKey = BackColor
        End Try
End Sub
have fun
hope you like this one
if some of you didn't know about this


NOT MY CODE JUST WANTED TO SHARE WITH YOU ALL ;)
#Birthday
Last edited by Dummy1912 on Wed Jul 30, 2014 1:03 pm, edited 1 time in total.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: Transparent form
smashapps
This is an interesting way of making the form transparent.
Is there a reason why this method is better than just setting the transparency key in the design view? Seems easier that way.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Transparent form
Dummy1912
hi #smashapps

well yea
if you use the default way and if your pc don't work great with transparent then you get a black or whatcolor you used at the background

with this it doesn't matter it stays transparent so far i tested it :)
the best way to test this is in windows xp
because the transparent does not work 100% in xp
so seems this way it does perfect ;)

#Birthday
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: Transparent form
XTechVB
You didn't do this by yourself, i saw it before on Daniweb.com if i'm not mistaken.
You should really give credit to the original author dude!

Good piece of code though.
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Transparent form
Dummy1912
#XTechVB
sorry i don't use daniweb
and i never said i made this code
read again and you will know

i only said:
seems all know how to make a Transparent Form
yea sure we do :) but why using the Transparencykey to set your form into

now you can even use a easier way:
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: Transparent form
smashapps
#XTechVB does have a point, you didn't say the code wasn't yours.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
6 posts Page 1 of 1
Return to “Tutorials”