Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I have one button and a trackbar..
please tell me in scroll event of that trackbar what i have to write to increase and decrease the size of the button

Thnk you
Posted
Updated 8-Jan-13 1:56am
v2

1 solution

Use the ValueChanged event instead.
Set the TrackBar.Minimum to the smallest size of the Button, set the Maximum to the largest.
In the ValueChanged Event:
C#
private void myTrackBar_ValueChanged(object sender, EventArgs e)
    {
    TrackBar tb = sender as TrackBar;
    if (tb != null)
        {
        myBubuttonToResize.Width = tb.Value;
        }
    }

[edit]Missed the VB bit! - OriginalGriff[/edit]

VB
Private Sub myTrackBar_ValueChanged(sender As Object, e As EventArgs)
    Dim tb As TrackBar = TryCast(sender, TrackBar)
    If tb IsNot Nothing Then
        myBubuttonToResize.Width = tb.Value
    End If
End Sub
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900