Unplanned
Last Updated: 17 Apr 2024 14:41 by ADMIN
ADMIN
Dimitar
Created on: 26 Mar 2014 08:19
Category: Buttons
Type: Bug Report
1
FIX. RadDropDownButton - when the AutoSize property is set to true and the button is anchored to top, right the button is resized to the right.
To reproduce:
- Add RadDropDownButton to a blank form.
- Set its anchor property to top, right and its AutoSize property to true.
- At runtime set the button text to a long string, you will notice that the button is resized to the right when it should be resized to the left.

To workaround this you can subscribe to the SizeChanged event of the button change its location depending on the new size:
Size prevSize;

public Form1()
{
    InitializeComponent();
    radDropDownButton1.AutoSize = true;

    this.Shown += Form1_Shown;
}

void Form1_Shown(object sender, EventArgs e)
{
    prevSize = radDropDownButton1.Size;

    radDropDownButton1.SizeChanged += radDropDownButton1_SizeChanged;
}

void radDropDownButton1_SizeChanged(object sender, EventArgs e)
{
    RadDropDownButton button = sender as RadDropDownButton;
    button.Location = new Point(button.Location.X - (radDropDownButton1.Size.Width - prevSize.Width), button.Location.Y);
    prevSize = button.Size;
    
}

private void radButton2_Click(object sender, EventArgs e)
{
    radDropDownButton1.Text = "Very long button text set";
}
0 comments