たとえば、ユーザーが背景色を変更すると、Settings.settings ファイルが変更されます。そして、それは機能します。
ただし、ユーザーが [OK] をクリックした後、アプリケーションは背景色を変更しません。アプリケーションを閉じて再度ビルドした場合にのみ機能します。
ボタンのクリック時にフォームまたはユーザー コントロールをリロードするにはどうすればよいですか? (.Refresh() で試してみましたが、動作しません)
private void refreshSettings()
{
this.BackColor = Properties.Settings.Default.bgdColor;
this.Font = Properties.Settings.Default.fontType;
this.ForeColor = Properties.Settings.Default.fontColor;
}
private void Settings_Load(object sender, EventArgs e)
{
refreshSettings();
bgdColorLBL.BackColor = Properties.Settings.Default.bgdColor;
fontColorLBL.BackColor = Properties.Settings.Default.fontColor;
fontTypeLBL.Font = Properties.Settings.Default.fontType;
fontTypeLBL.Text = Properties.Settings.Default.fontType.Name;
}
private void okBTN_Click(object sender, EventArgs e)
{
LeagueUC lg = new LeagueUC();
InitializeComponent();
this.Close();
}
private void bgdColorLBL_Click(object sender, EventArgs e)
{
ColorDialog dlg = new ColorDialog();
dlg.Color = Properties.Settings.Default.bgdColor;
if (dlg.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.bgdColor = dlg.Color;
Properties.Settings.Default.Save();
bgdColorLBL.BackColor = dlg.Color;
}
}