Click here to Skip to main content
13,346,065 members (58,239 online)
Rate this:
Please Sign up or sign in to vote.
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 8-Jan-13 2:55am
Updated 8-Jan-13 2:56am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:
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]

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100