Rockbomb
Dog fucker (but in a good way now)
2009 Nov 14 • 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 19:48 UTC
|
|
|
|
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 9 at 03:30 UTC
— Ed. 2009 Dec 9 at 03:38 UTC
|
|
|
Rockbomb
Dog fucker (but in a good way now)
2009 Nov 14 • 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 9 at 03:56 UTC
|
|
|
Rockbomb
Dog fucker (but in a good way now)
2009 Nov 14 • 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 10 at 02:45 UTC
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse
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 10 at 03:01 UTC
|
|
|
aaronjer
*****'n Admin
2005 Mar 21 • 5105
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 10 at 04:54 UTC
— Ed. 2009 Dec 10 at 04:55 UTC
|
|
|
Rockbomb
Dog fucker (but in a good way now)
2009 Nov 14 • 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 10 at 05:07 UTC
— Ed. 2009 Dec 10 at 05:26 UTC
|
|
|
|
Cool. Thanks for posting what worked.
|
|
|
|
≡
|
2009 Dec 10 at 19:50 UTC
|
|
|
|
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 19:33 UTC
— Ed. 2009 Dec 12 at 19:38 UTC
|
|
|
Rockbomb
Dog fucker (but in a good way now)
2009 Nov 14 • 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 20:03 UTC
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse
2007 Oct 19 • 5486
57,583 ₧
|
Don't use bing, it's shit. Use Google. :)
|
|
|
|
≡
|
2009 Dec 12 at 20:58 UTC
|
|
|
|
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 20:58 UTC
|
|
|
|
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 20:59 UTC
— Ed. 2009 Dec 12 at 21:00 UTC
|
|
|
Rockbomb
Dog fucker (but in a good way now)
2009 Nov 14 • 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 21:00 UTC
|
|
|
|
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 21:02 UTC
— Ed. 2009 Dec 12 at 21:03 UTC
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse
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 23:45 UTC
|
|
|
|
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 13 at 01:23 UTC
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse
2007 Oct 19 • 5486
57,583 ₧
|
But on the other hand, "I'm feeling lucky".
|
|
|
|
≡
|
2009 Dec 13 at 02:30 UTC
|
|
|
|
i never had to use bing but for only the things i RELLEY need
I drink to forget but I always remember.
|
|
|
|
≡
|
2009 Dec 13 at 02:33 UTC
|
|
|
|
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 13 at 06:53 UTC
— Ed. 2009 Dec 13 at 09:09 UTC
|
|
|
|
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 16 at 06:14 UTC
|
|
|
|
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 08:12 UTC
— Ed. 2009 Dec 16 at 08:14 UTC
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse
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 13:25 UTC
|
|
|
|
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 13:46 UTC
|
|
|
Down Rodeo
Cap'n Moth of the Firehouse
2007 Oct 19 • 5486
57,583 ₧
|
|
|
|
|
≡
|
2009 Dec 16 at 14:33 UTC
|
|
|
|