Page 1 of 1

Trackbars in VB.

Posted: Tue Jul 03, 2007 11:03 pm
by Patrickh
How do I code for the trackbar, in such a way that when it is set to tick 1, opacity = 25, 2 = 50, or whatever. I just don't understand how to code for the trackbar. Thanks

Posted: Wed Jul 04, 2007 8:03 am
by OwnZ joO
I don't use trackbars so I don't know for sure, but it would involve using an event handler for ontrackbarchange or something, and you would then put opacity = (25 * trackbar.index)

Posted: Wed Jul 04, 2007 9:15 am
by dos mes
Under the trackbar scroll event handler:

Code: Select all

this.opacity = .1 * trackbar.value;
for vb, just change 'this' to 'me' and remove the semicolon

Posted: Wed Jul 04, 2007 9:19 am
by Prey

Code: Select all

// trackbar1.Maximum = 99, set to 100 and you'll see some crappy black stuff when going from 100 to 99

private void trackBar1_Scroll(object sender, EventArgs e)
{
    this.Opacity = trackBar1.Value * 0.01;
}
Edit: Yeaa^^
~He asked for VB, not C#
I know.

Posted: Wed Jul 04, 2007 7:00 pm
by Patrickh
thanks guys, that worked :wink: .