I have lots of radiobutton in a panel with auto scroll set to true. One of the radiobutton is checked. I want to make sure that that the checked one should be visible i.e. the vertical scrollbar should be moved so that the checked radiobutton is visible.
Is there any way to do it?
P.S. I have tried as bellow but it is not working
RadioButton radiobutton = new RadioButton();
.....
panel.Controls.Add(radioButton);
if (some logic)
{
radioButton.Checked = true;
panel.ScrollControlIntoView(radioButton);
}
To fix this, I add the above mentioned code (
panel.ScrollControlIntoView(radioButton)) after the form is shown (i.e. in the event handler forform_Shownevent).This is working now. But I still don’t have the correct explanation for this.