|
-
Dec 29th, 2005, 03:40 PM
#1
Thread Starter
Lively Member
[RESOLVED] Picturebox opacity
All,
I've seen an number of posts having to do with setting the opacity of a form.....and I just made that work......what I'd like to do is to fade in and fade out a picturebox. I don't see any built-in way to do it, anybody have a clue? Can i create a form inside of a form where the form inside only has a picturebox in it? Would that work?
thanks!
kgb
Last edited by cageybee; Dec 29th, 2005 at 03:56 PM.
-
Dec 30th, 2005, 09:37 AM
#2
Re: Picturebox opacity
i found something that might help you a little with this
http://www.vb-helper.com/howto_net_blend_animation.html
-
Dec 30th, 2005, 02:32 PM
#3
Thread Starter
Lively Member
Re: Picturebox opacity
Thanks Derek....I'll study this and see if I can figure out exactly how to use it. I've been playing with this (ipass*63 is the alpha (opacity)) doesn't work yet though! :
Public Function fade_out()
Dim ipass As Integer
Dim mycolor As Color
Dim myBrush As New SolidBrush(mycolor)
Dim yd, xd As Integer
For ipass = 1 to 4
mycolor = Color.FromArgb(ipass * 63, 23, 56, 78)
PictureBox1.CreateGraphics.FillRectangle(mybrush, 0, 0, 720, 648)
System.Threading.Thread.CurrentThread.Sleep(1000)
'Next
Next
myBrush.Dispose()
PictureBox1.CreateGraphics.Dispose()
Last edited by cageybee; Dec 30th, 2005 at 02:41 PM.
-
Dec 30th, 2005, 02:54 PM
#4
Thread Starter
Lively Member
Re: Picturebox opacity
This is very close to working now:
Public Function fade_out()
Dim ipass As Integer
Dim mycolor As System.Drawing.Color
Dim yd, xd As Integer
For ipass = 1 To 16
mycolor = Color.FromArgb(ipass * 16, 23, 56, 78)
Dim myBrush As New SolidBrush(mycolor)
PictureBox1.CreateGraphics.FillRectangle(myBrush, 0, 0, 720, 648)
System.Threading.Thread.CurrentThread.Sleep(100)
Next
PictureBox1.CreateGraphics.Dispose()
I DON'T like the DIM statement in the loop...but don't know how to make it work otherwise. The rectangle being filled is obviously the entire picturebox.
kgb
-
Dec 30th, 2005, 02:56 PM
#5
Re: Picturebox opacity
VB Code:
Public Function fade_out()
Dim ipass As Integer
Dim mycolor As System.Drawing.Color
Dim yd, xd As Integer
For ipass = 1 To 16
mycolor = Color.FromArgb(ipass * 16, 23, 56, 78)
'Dim myBrush As New SolidBrush(mycolor)
PictureBox1.CreateGraphics.FillRectangle(New SolidBrush(mycolor), 0, 0, 720, 648)
System.Threading.Thread.CurrentThread.Sleep(100)
Next
PictureBox1.CreateGraphics.Dispose()
End Sub
-
Dec 30th, 2005, 03:43 PM
#6
Thread Starter
Lively Member
Re: Picturebox opacity
YA!!!! Much better! Thanks! changed it a little below to fade to "Control" color
Public Function fade_out()
Dim ipass As Integer
Dim mycolor As System.Drawing.Color
For ipass = 1 To 28
mycolor = Color.FromArgb(ipass * 4, 230, 230, 210)
PictureBox1.CreateGraphics.FillRectangle(New SolidBrush(mycolor), 0, 0, 720, 648)
System.Threading.Thread.CurrentThread.Sleep(5)
Next
PictureBox1.CreateGraphics.Dispose()
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|