How do I make my program transparent?

How do I make my program transparent?

Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
So, I wanna make a program that isn't contained to a boring rectangle. I designed a background in photoshop and used a lime green color as the background color (for the part I want to be transparent), and then in VB I set the TransparencyKey property of the form to the same color... but when I ran it I could still see the green and it wan't transparent at all. Is there something else I have to do to make it work?
 
 
2009 Dec 8 at 11:48 PST
SuperJer
Websiteman

2005 Mar 20 • 6152
What version of VB?

Ok I'm guessing VB.NET 2008 from your other truck.

VB code
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Me.ControlBox = False Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.TransparencyKey = System.Drawing.Color.Green End Sub

This should get rid of the _[]X controls and the window border and make green transparent.

You might need some magic to use the same green as "System.Drawing.Color.Green" or specify the color some other way.

Hell if I know anything about VB.NET
 
 
2009 Dec 8 at 19:30 PST — Ed. 2009 Dec 8 at 19:38 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
superjer said:
What version of VB?

Ok I'm guessing VB.NET 2008 from your other truck.

VB code
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load Me.ControlBox = False Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.TransparencyKey = System.Drawing.Color.Green End Sub

This should get rid of the _[]X controls and the window border and make green transparent.

You might need some magic to use the same green as "System.Drawing.Color.Green" or specify the color some other way.

Hell if I know anything about VB.NET



Thanks man, I'll give it a try :D
 
 
2009 Dec 8 at 19:56 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
Well, I got it to work if I use a background color, so I can make the entire thing transparent. But it still won't work with a picture. Is there a certain format I need to use? I've tried using a jpg and getting vb to make the green transparent, and I've also tried making a bitmap and using an alpha layer for transparency, neither worked :/
 
 
2009 Dec 9 at 18:45 PST
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Well jpegs won't really have that exact shade of green, probably. For details, see the ideas behind jpeg. Uh, you could try PNG, it has alpha support builtin. PNG is awesome.
 
 
2009 Dec 9 at 19:01 PST
aaronjer
*****'n Admin

Comrade General 5-Star
2005 Mar 21 • 4600
1,227 ₧
You'll notice I pretty much exclusively draw things in .png format. And if "I'm" doing it, it must be a good idea. Yeah, alpha is pretty fuckin' useful when you're drawing or for almost anything else.

High-five, DR! Yeah, buddy!
 
 
2009 Dec 9 at 20:54 PST — Ed. 2009 Dec 9 at 20:55 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
aaronjer said:
And if "I'm" doing it, it must be a good idea.



You make a good point.
Portable Network Graphics, here I come!

Edit: Got it :D
So, in case anyone wants to make a custom shaped project, this is what I figured out. You can't make a color in your background image transparent (I think), but if you make a transparent .png, it will show the background through it. So you have to make a transparent .png, then set a transparency key, then add a background.color that is the same color as the transparency key you set.
 
 
2009 Dec 9 at 21:07 PST — Ed. 2009 Dec 9 at 21:26 PST
SuperJer
Websiteman

2005 Mar 20 • 6152
Cool. Thanks for posting what worked.
 
 
2009 Dec 10 at 11:50 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Rockbomb said:
aaronjer said:
And if "I'm" doing it, it must be a good idea.



You make a good point.
Portable Network Graphics, here I come!

Edit: Got it :D
So, in case anyone wants to make a custom shaped project, this is what I figured out. You can't make a color in your background image transparent (I think), but if you make a transparent .png, it will show the background through it. So you have to make a transparent .png, then set a transparency key, then add a background.color that is the same color as the transparency key you set.



Is that only limited to the entire form, or can I make a sweet awesome button like that?

Edit :: Yes!

Should have searched Google [actually Bing] first
 
 
2009 Dec 12 at 11:33 PST — Ed. 2009 Dec 12 at 11:38 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
One thing I'd recommend though, is instead of using a bitmap like that guide says, use a .png, the quality usually turns out a lot better.
 
 
2009 Dec 12 at 12:03 PST
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
 
 
2009 Dec 12 at 12:58 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
One thing I found out though was that, after dicking around for an hour now, that gimp lets you set the background colour to transparent. So all this time i spent trying to get the transparency key right..........Jesus...
 
 
2009 Dec 12 at 12:58 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Down Rodeo said:
Don't use bing, it's shit. Use Google. :)


And no, Bing kicks ass over Google any day.
 
 
2009 Dec 12 at 12:59 PST — Ed. 2009 Dec 12 at 13:00 PST
Rockbomb
Dog fucker (but in a good way now)

2009 Nov 13 • 2045
Idk about gimp, but on photoshop you can just leave the background clear (checkerboarded) then save as a PNG and it will stay clear, that way you don't even need to worry about a transparency key.
 
 
2009 Dec 12 at 13:00 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Rockbomb said:
Idk about gimp, but on photoshop you can just leave the background clear (checkerboarded) then save as a PNG and it will stay clear, that way you don't even need to worry about a transparency key.



Yea, basically same in Gimp.

I jus' cannot find a decent colour though.
 
 
2009 Dec 12 at 13:02 PST — Ed. 2009 Dec 12 at 13:03 PST
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
sprinkles said:
Down Rodeo said:
Don't use bing, it's shit. Use Google. :)


And no, Bing kicks ass over Google any day.

How?
 
 
2009 Dec 12 at 15:45 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Down Rodeo said:
sprinkles said:
Down Rodeo said:
Don't use bing, it's shit. Use Google. :)


And no, Bing kicks ass over Google any day.

How?


It gives me what I want when I want, Google gives me porn except when I intentionally search for porn.
 
 
2009 Dec 12 at 17:23 PST
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
 
 
2009 Dec 12 at 18:30 PST
the_cloud_system
polly pushy pants

2008 Aug 1 • 3069
-6 ₧
i never had to use bing but for only the things i RELLEY need
I drink to forget but I always remember.
 
 
2009 Dec 12 at 18:33 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Ok I have a string that is a directory
C:\here\there\thing.ext
I need to get the file name [ie thing.ext] into a different string
the catch is the directory wont always be the same
How would I do that in vb?


Edit I got it will post solution in morning tired...
 
 
2009 Dec 12 at 22:53 PST — Ed. 2009 Dec 13 at 01:09 PST
SuperJer
Websiteman

2005 Mar 20 • 6152
Don't know VB much but you should be able to find the last slash "\" and grab the part after it.

Or look for a basename() function in VB.
 
 
2009 Dec 15 at 22:14 PST
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
VB.net code
'seperates the directory from the file disgarding the directory and saving the file to mapname Public Function findmapname() Dim endpoint As Integer endpoint=map20.LastIndexOf("\") endpoint=endpoint+1 mapname=map20.Remove(0,endpoint) Return mapname End Function


Doesn't help me a damn bit though, because I decided to go with C# now instead of vb. [which ironically I was going to learn first]
 
 
2009 Dec 16 at 00:12 PST — Ed. 2009 Dec 16 at 00:14 PST
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
You should use regular expressions!

Which, interestingly enough, are no longer considered regular! That is, their complexity is greater than than a regular language, they're now something like a context-free.
 
 
2009 Dec 16 at 05:25 PST
Mate de Vita
Kelli

2008 Oct 4 • 2453
159 ₧
Down Rodeo said:
You should use regular expressions!

Which, interestingly enough, are no longer considered regular! That is, their complexity is greater than than a regular language, they're now something like a context-free.

than than?
...and that's the bottom line because Mate de Vita said so.
 
 
2009 Dec 16 at 05:46 PST
Page [1] 2