How do I make my program transparent?
Pages: [1], 2
|
|
Programming Help
|
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
|
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
|
|
|
superjer
superjer

2005 Mar 20 • 3742
|
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
|
|
|
|
|
(Edited 2009 Dec 8 at 19:38)
2009 Dec 8 at 19:30
|
|
|
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
|
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
|
|
|
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
|
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
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse


2007 Oct 19 • 5258
57,583 ₧
|
|
|
|
|
|
2009 Dec 9 at 19:01
|
|
|
|
|
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
|
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.
|
|
|
|
|
(Edited 2009 Dec 9 at 21:26)
2009 Dec 9 at 21:07
|
|
|
|
|
sprinkles


2009 Sep 6 • 2431
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
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
(Edited 2009 Dec 12 at 11:38)
2009 Dec 12 at 11:33
|
|
|
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
|
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
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse


2007 Oct 19 • 5258
57,583 ₧
|
|
|
|
|
|
2009 Dec 12 at 12:58
|
|
|
sprinkles


2009 Sep 6 • 2431
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...
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
2009 Dec 12 at 12:58
|
|
|
sprinkles


2009 Sep 6 • 2431
10 ₧
|
Down Rodeo said: Don't use bing, it's shit. Use Google. :)
And no, Bing kicks ass over Google any day.
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
(Edited 2009 Dec 12 at 13:00)
2009 Dec 12 at 12:59
|
|
|
Rockbomb
Dog fucker

2009 Nov 13 • 1849
-190 ₧
|
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
|
|
|
sprinkles


2009 Sep 6 • 2431
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.
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
(Edited 2009 Dec 12 at 13:03)
2009 Dec 12 at 13:02
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse


2007 Oct 19 • 5258
57,583 ₧
|
|
|
|
|
|
2009 Dec 12 at 15:45
|
|
|
sprinkles


2009 Sep 6 • 2431
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.
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
2009 Dec 12 at 17:23
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse


2007 Oct 19 • 5258
57,583 ₧
|
|
|
|
|
|
2009 Dec 12 at 18:30
|
|
|
the_cloud_system
polly pushy pants

2008 Aug 1 • 2788
-6 ₧
|
i never had to use bing but for only the things i RELLEY need
moo moo moo, moo.
|
|
|
|
|
2009 Dec 12 at 18:33
|
|
|
sprinkles


2009 Sep 6 • 2431
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...
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
(Edited 2009 Dec 13 at 01:09)
2009 Dec 12 at 22:53
|
|
|
superjer
superjer

2005 Mar 20 • 3742
|
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
|
|
|
sprinkles


2009 Sep 6 • 2431
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]
...then I got some ap, and shot a big ass lazar at everyone.
|
|
|
|
|
(Edited 2009 Dec 16 at 00:14)
2009 Dec 16 at 00:12
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse


2007 Oct 19 • 5258
57,583 ₧
|
|
|
|
|
|
2009 Dec 16 at 05:25
|
|
|
Mate de Vita
Kelli

2008 Oct 4 • 2397
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.
Who controls the past, controls the future. Who controls the present, controls the past.
|
|
|
|
|
2009 Dec 16 at 05:46
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse


2007 Oct 19 • 5258
57,583 ₧
|
|
|
|
|
|
2009 Dec 16 at 06:33
|
|
|
|
|