我有一个C#.NET 3.0项目,使用TableLayoutPanel包含几行控件。如果向下滚动以使顶层项目不再可见,则删除一列中的控件并将其替换为新控件,TableLayoutPanel将滚动回顶端。停止从滚动tablelayoutnel
/// the panel in question
private System.Windows.Forms.TableLayoutPanel impl_;
/// The user has clicked a linklabel in the panel. replace it with an edit-box
private void OnClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
LinkLabel link_label = sender as LinkLabel;
TextBox new_edit = new TextBox();
// setup the new textbox...
TableLayoutPanelCellPosition pos = impl_.GetCellPosition(link_label);
impl_.Controls.Remove(link_label);
impl_.Controls.Add(new_edit, pos.Column, pos.Row);
new_edit.Focus();
}
为了防止滚动位置发生变化,我需要做些什么?