This is a migrated thread and some comments may be shown as answers.
radtrackbar
1 Answer 21 Views
This is a migrated thread and some comments may be shown as answers.
Behin
Top achievements
Rank 1
Behin asked on 14 Oct 2012, 01:07 PM
Hello
I have a trackbar and a grid in my form ,I want to change the width of grid columns by scrolling the trackbar, for example when I scrool to right the columns width change to columns width +5and when I scroll trackbar to the left  the columns width change to columns width -5.
please help me to do this.
thanks alot

1 Answer, 1 is accepted

Sort by
0
Accepted
Anton
Telerik team
answered on 17 Oct 2012, 01:31 PM
Hi Behin,

Thank you for writing.

To achieve the desired functionality, simply subscribe to the Scroll or the ValueChanged event and use following code snippet:
if (this.radTrackBar1.Value > oldValue)
{
    foreach (GridViewColumn item in this.radGridView1.Columns)
    {
        item.Width += (this.radTrackBar1.Value - oldValue) * 5;
    }
}
else
{
    foreach (GridViewColumn item in this.radGridView1.Columns)
    {
        item.Width -= (oldValue - this.radTrackBar1.Value) * 5;
    }
}
oldValue = this.radTrackBar1.Value;
Attached is a sample project.

I hope this information helps. If you have further questions, feel free to write back

Regards,
Anton
the Telerik team
You’ve been asking for it and now it’s time for us to deliver. RadControls for WinForms Q3 2012 release is just around the corner. Sign up for a free webinar to see first all the latest enhancements.
Asked by
Behin
Top achievements
Rank 1
Answers by
Anton
Telerik team
Share this question
or