Transparent images in VB

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
mr_penguin





Posts: 541
Joined: Thu Feb 08, 2007 5:39 pm
Location: NJ

Transparent images in VB

Post by mr_penguin »

I'm trying to get an image to fade from solid to transparent. I'm using photoshop to make the image but when I use it in VB it makes the transparent part white. I've tried using different formats and using an alpha layer.

Also I'm trying to make a TrackBar control the opacity of the form but I can't seem to get it to work right. This is what I've done:

Code: Select all

Private Sub TrackBar1_Scroll(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        Form1.Opacity = Me.TrackBar1.Value
End Sub
Doing that just makes the opacity 0 or 100, I've set the maximum value to 100 and the min to 0 but that still didn't work.
Your mom became oversized. Please make your mom smaller before reposting. :shock:
Infern0 wrote:You just shave the excess bush and burn the leftovers.
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post by Patrickssj6 »

Opacity goes from 0 to 1 in floating point numbers e.g. 0.1 makes it 10% transparent.
mr_penguin





Posts: 541
Joined: Thu Feb 08, 2007 5:39 pm
Location: NJ

Post by mr_penguin »

so I should leave the code the same but change it to:

Form1.Opacity = Me.TrackBar1.Value / 100

Edit: thats works
Last edited by mr_penguin on Wed Apr 30, 2008 1:51 pm, edited 1 time in total.
Your mom became oversized. Please make your mom smaller before reposting. :shock:
Infern0 wrote:You just shave the excess bush and burn the leftovers.
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post by Patrickssj6 »

How about you try it... :wink:
User avatar
Dagger13





Posts: 370
Joined: Wed Nov 22, 2006 12:37 pm

Post by Dagger13 »

or you can just make the trackbar 0 to 1
for the other thing i found one on a vb site i forgot witch one but maybe you can google it then if you find one with a search box then search w/e on that site


i seen the code before a long time ago tho but i know it was like one line to change the alpha to 0(or anything) and it had "matrix" in it
Image(An Old one.)
Jdogg





Posts: 184
Joined: Thu Aug 31, 2006 3:18 pm

Post by Jdogg »

I had this probme before
Here it is.

Code: Select all

Dim opac as integer
opac = TrackBar1.Value * 0.01
Me.Opacity = opac
mr_penguin





Posts: 541
Joined: Thu Feb 08, 2007 5:39 pm
Location: NJ

Post by mr_penguin »

Well now that the least needed fix is solved, how can I get transparent images to work?
Your mom became oversized. Please make your mom smaller before reposting. :shock:
Infern0 wrote:You just shave the excess bush and burn the leftovers.
Post Reply