| View previous topic :: View next topic |
| Author |
Message |
Dillonz Grandmaster Cheater
Reputation: 4
Joined: 20 Jan 2008 Posts: 758 Location: Under your bed
|
Posted: Fri Oct 09, 2009 8:17 pm Post subject: VB Express: Changing form opacity |
|
|
| How exactly can I change the opacity using an HScrollBar? I found some code on Google but I couldn't modify it to do what I wanted it to do.
|
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Fri Oct 09, 2009 9:16 pm Post subject: |
|
|
| Code: | Private Sub hbarOpacity_Scroll(ByVal sender As _System.Object, ByVal e As _System.Windows.Forms.ScrollEventArgs) HandleshbarOpacity.Scroll
Me.Opacity = 0.1 + hbarOpacity.Value / 100
Me.Text = Me.Opacity.ToString
End Sub |
|
|
| Back to top |
|
 |
Dillonz Grandmaster Cheater
Reputation: 4
Joined: 20 Jan 2008 Posts: 758 Location: Under your bed
|
Posted: Fri Oct 09, 2009 10:36 pm Post subject: |
|
|
| 1 wrote: | | Code: | Private Sub hbarOpacity_Scroll(ByVal sender As _System.Object, ByVal e As _System.Windows.Forms.ScrollEventArgs) HandleshbarOpacity.Scroll
Me.Opacity = 0.1 + hbarOpacity.Value / 100
Me.Text = Me.Opacity.ToString
End Sub |
|
Getting a bunch of errors.
|
|
| Back to top |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Sat Oct 10, 2009 8:05 am Post subject: |
|
|
Try this:
| Code: | Private Sub hbarOpacity_Scroll(ByVal sender As _System.Object, ByVal e As _System.Windows.Forms.ScrollEventArgs) Handles hbarOpacity.Scroll
' Just set the trackbar value range to 10-100
Me.Opacity = hbarOpacity.Value / 100
End Sub |
If that doesn't do it, check that your trackbar is actually named hbarOpacity.
_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren |
|
| Back to top |
|
 |
Dillonz Grandmaster Cheater
Reputation: 4
Joined: 20 Jan 2008 Posts: 758 Location: Under your bed
|
Posted: Sat Oct 10, 2009 8:30 am Post subject: |
|
|
| Odecey wrote: | Try this:
| Code: | Private Sub hbarOpacity_Scroll(ByVal sender As _System.Object, ByVal e As _System.Windows.Forms.ScrollEventArgs) Handles hbarOpacity.Scroll
' Just set the trackbar value range to 10-100
Me.Opacity = hbarOpacity.Value / 100
End Sub |
If that doesn't do it, check that your trackbar is actually named hbarOpacity. |
That works great thanks! Time to make useful VB Express code folder in my documents
|
|
| Back to top |
|
 |
NoManchesPuto I post too much
Reputation: 0
Joined: 24 Jan 2009 Posts: 2820
|
Posted: Sat Oct 10, 2009 5:58 pm Post subject: |
|
|
| Dillonz wrote: | | 1 wrote: | | Code: | Private Sub hbarOpacity_Scroll(ByVal sender As _System.Object, ByVal e As _System.Windows.Forms.ScrollEventArgs) Handles hbarOpacity.Scroll
Me.Opacity = 0.1 + hbarOpacity.Value / 100
Me.Text = Me.Opacity.ToString
End Sub |
|
Getting a bunch of errors. |
Things you should have done w/o any help:
Remove the 2nd line of code (don't need it)
Name the items correctly if not done so already
Set the min and max
then you wouldn't have any errors
|
|
| Back to top |
|
 |
|