我创建了一个splitterLocation设置,输入system.Drawing.Point和Scope:User。在用户更改时保存拆分器位置。并在表单加载时再次使用新位置加载。
private void splitter1_LocationChanged(object sender, EventArgs e)
{
MailSystem.Properties.Settings.Default.splitterLocation = splitter1.Location;
MailSystem.Properties.Settings.Default.Save();
}
private void Form1_Load(object sender, EventArgs e)
{
splitter1.Location = MailSystem.Properties.Settings.Default.splitterLocation;
}
但它不起作用我不知道为什么?。
答案 0 :(得分:1)
尝试将保存代码移至FormClosing事件。
private void Form1_FormClosing(object sender, EventArgs e)
{
MailSystem.Properties.Settings.Default.splitterLocation = splitter1.Location;
MailSystem.Properties.Settings.Default.Save();
}
并确保您的splitter1控件未停靠,DockStyle.None。