private void Label_ImmersiveExperience_Click(object sender, EventArgs e) { try { if (OpenFileDialog_ImmersiveExperience.ShowDialog() == DialogResult.OK) { ImmersiveExperienceBackgroundImage = new Bitmap(Image.FromFile(OpenFileDialog_ImmersiveExperience.FileName)); if (ImmersiveExperienceBackgroundImage != null) { Me.Size = ImmersiveExperienceBackgroundImage.Size; Me.CaptionBarBackgroundImage = ImmersiveExperienceBackgroundImage; // Panel_Main.Refresh(); } } } catch { ImmersiveExperienceBackgroundImage = null; } if (ImmersiveExperienceBackgroundImage == null) { CheckBox_ImmersiveExperience.Checked = false; } }
private void CheckBox_ImmersiveExperience_CheckedChanged(object sender, EventArgs e) { CheckBox Ctrl = sender as CheckBox; if (Ctrl != null) { Action UpdateUI = () => { ComboBox_FormStyleEnum.SelectedIndexChanged -= ComboBox_FormStyleEnum_SelectedIndexChanged; ComboBox_FormStyleEnum.SelectedIndex = (int)Me.FormStyle; ComboBox_FormStyleEnum.SelectedIndexChanged += ComboBox_FormStyleEnum_SelectedIndexChanged; CheckBox_EnableMaximize.CheckedChanged -= CheckBox_EnableMaximize_CheckedChanged; CheckBox_EnableFullScreen.CheckedChanged -= CheckBox_EnableFullScreen_CheckedChanged; CheckBox_ShowIconOnCaptionBar.CheckedChanged -= CheckBox_ShowIconOnCaptionBar_CheckedChanged; CheckBox_TopMost.CheckedChanged -= CheckBox_TopMost_CheckedChanged; CheckBox_ShowInTaskbar.CheckedChanged -= CheckBox_ShowInTaskbar_CheckedChanged; CheckBox_EnableMaximize.Checked = Me.EnableMaximize; CheckBox_EnableFullScreen.Checked = Me.EnableFullScreen; CheckBox_ShowIconOnCaptionBar.Checked = Me.ShowIconOnCaptionBar; CheckBox_TopMost.Checked = Me.TopMost; CheckBox_ShowInTaskbar.Checked = Me.ShowInTaskbar; CheckBox_EnableMaximize.CheckedChanged += CheckBox_EnableMaximize_CheckedChanged; CheckBox_EnableFullScreen.CheckedChanged += CheckBox_EnableFullScreen_CheckedChanged; CheckBox_ShowIconOnCaptionBar.CheckedChanged += CheckBox_ShowIconOnCaptionBar_CheckedChanged; CheckBox_TopMost.CheckedChanged += CheckBox_TopMost_CheckedChanged; CheckBox_ShowInTaskbar.CheckedChanged += CheckBox_ShowInTaskbar_CheckedChanged; // ComboBox_ThemeEnum.SelectedIndexChanged -= ComboBox_ThemeEnum_SelectedIndexChanged; ComboBox_ThemeEnum.SelectedIndex = (int)Me.Theme; ComboBox_ThemeEnum.SelectedIndexChanged += ComboBox_ThemeEnum_SelectedIndexChanged; Label_ThemeColor_Value.Text = Com.ColorManipulation.GetColorName(Me.ThemeColor); CheckBox_ShowCaption.CheckedChanged -= CheckBox_ShowCaption_CheckedChanged; CheckBox_ShowCaption.Checked = Me.ShowCaption; CheckBox_ShowCaption.CheckedChanged += CheckBox_ShowCaption_CheckedChanged; CheckBox_ShowCaptionBarColor.CheckedChanged -= CheckBox_ShowCaptionBarColor_CheckedChanged; CheckBox_EnableCaptionBarTransparent.CheckedChanged -= CheckBox_EnableCaptionBarTransparent_CheckedChanged; CheckBox_ShowCaptionBarColor.Checked = Me.ShowCaptionBarColor; CheckBox_EnableCaptionBarTransparent.Checked = Me.EnableCaptionBarTransparent; CheckBox_ShowCaptionBarColor.CheckedChanged += CheckBox_ShowCaptionBarColor_CheckedChanged; CheckBox_EnableCaptionBarTransparent.CheckedChanged += CheckBox_EnableCaptionBarTransparent_CheckedChanged; CheckBox_ShowShadowColor.CheckedChanged -= CheckBox_ShowShadowColor_CheckedChanged; CheckBox_ShowShadowColor.Checked = Me.ShowShadowColor; CheckBox_ShowShadowColor.CheckedChanged += CheckBox_ShowShadowColor_CheckedChanged; }; if (Ctrl.Checked) { CheckBox_ImmersiveExperience.CheckedChanged -= CheckBox_ImmersiveExperience_CheckedChanged; CheckBox_ImmersiveExperience.Checked = false; CheckBox_ImmersiveExperience.CheckedChanged += CheckBox_ImmersiveExperience_CheckedChanged; // if (ImmersiveExperienceBackgroundImage == null) { try { if (OpenFileDialog_ImmersiveExperience.ShowDialog() == DialogResult.OK) { ImmersiveExperienceBackgroundImage = new Bitmap(Image.FromFile(OpenFileDialog_ImmersiveExperience.FileName)); } } catch { ImmersiveExperienceBackgroundImage = null; } } if (ImmersiveExperienceBackgroundImage != null) { CheckBox_ImmersiveExperience.CheckedChanged -= CheckBox_ImmersiveExperience_CheckedChanged; CheckBox_ImmersiveExperience.Checked = true; CheckBox_ImmersiveExperience.CheckedChanged += CheckBox_ImmersiveExperience_CheckedChanged; // Label_FormStyleEnum.Enabled = ComboBox_FormStyleEnum.Enabled = false; CheckBox_EnableMaximize.Enabled = false; CheckBox_EnableFullScreen.Enabled = false; CheckBox_ShowIconOnCaptionBar.Enabled = false; Label_ThemeEnum.Enabled = ComboBox_ThemeEnum.Enabled = false; Label_ThemeColor.Enabled = Label_ThemeColor_Value.Enabled = false; CheckBox_ShowCaption.Enabled = false; Label_CaptionFont.Enabled = Label_CaptionFont_Value.Enabled = false; Label_CaptionAlignEnum.Enabled = ComboBox_CaptionAlignEnum.Enabled = false; CheckBox_ShowCaptionBarColor.Enabled = false; CheckBox_EnableCaptionBarTransparent.Enabled = false; CheckBox_ShowCaptionBarColor.Enabled = false; CheckBox_ShowShadowColor.Enabled = false; Label_BoundsSize.Enabled = TextBox_BoundsWidth.Enabled = TextBox_BoundsHeight.Enabled = false; Label_ImmersiveExperience.Enabled = true; // FormStyle_BeforeImmersiveExperience = Me.FormStyle; EnableMaximize_BeforeImmersiveExperience = Me.EnableMaximize; EnableFullScreen_BeforeImmersiveExperience = Me.EnableFullScreen; ShowIconOnCaptionBar_BeforeImmersiveExperience = Me.ShowIconOnCaptionBar; Me.FormStyle = Com.WinForm.FormStyle.Fixed; Me.EnableMaximize = false; Me.EnableFullScreen = false; Me.ShowIconOnCaptionBar = false; Theme_BeforeImmersiveExperience = Me.Theme; ThemeColor_BeforeImmersiveExperience = Me.ThemeColor; ShowCaption_BeforeImmersiveExperience = Me.ShowCaption; ShowCaptionBarColor_BeforeImmersiveExperience = Me.ShowCaptionBarColor; EnableCaptionBarTransparent_BeforeImmersiveExperience = Me.EnableCaptionBarTransparent; ShowShadowColor_BeforeImmersiveExperience = Me.ShowShadowColor; Me.Theme = Com.WinForm.Theme.Black; Me.ThemeColor = new Com.ColorX(Color.Black); Me.ShowCaption = false; Me.ShowCaptionBarColor = false; Me.EnableCaptionBarTransparent = false; Me.ShowShadowColor = false; Size_BeforeImmersiveExperience = Me.Size; Me.Size = ImmersiveExperienceBackgroundImage.Size; Me.CaptionBarBackgroundImage = ImmersiveExperienceBackgroundImage; // Panel_Main.Refresh(); UpdateUI(); } } else { Me.CaptionBarBackgroundImage = null; Me.FormStyle = FormStyle_BeforeImmersiveExperience; Me.EnableMaximize = EnableMaximize_BeforeImmersiveExperience; Me.EnableFullScreen = EnableFullScreen_BeforeImmersiveExperience; Me.ShowIconOnCaptionBar = ShowIconOnCaptionBar_BeforeImmersiveExperience; Me.Theme = Theme_BeforeImmersiveExperience; Me.ThemeColor = ThemeColor_BeforeImmersiveExperience; Me.ShowCaption = ShowCaption_BeforeImmersiveExperience; Me.ShowCaptionBarColor = ShowCaptionBarColor_BeforeImmersiveExperience; Me.EnableCaptionBarTransparent = EnableCaptionBarTransparent_BeforeImmersiveExperience; Me.ShowShadowColor = ShowShadowColor_BeforeImmersiveExperience; Me.Size = Size_BeforeImmersiveExperience; // Label_FormStyleEnum.Enabled = ComboBox_FormStyleEnum.Enabled = true; CheckBox_EnableMaximize.Enabled = true; CheckBox_EnableFullScreen.Enabled = true; CheckBox_ShowIconOnCaptionBar.Enabled = true; Label_ThemeEnum.Enabled = ComboBox_ThemeEnum.Enabled = true; Label_ThemeColor.Enabled = Label_ThemeColor_Value.Enabled = true; CheckBox_ShowCaption.Enabled = true; Label_CaptionFont.Enabled = Label_CaptionFont_Value.Enabled = true; Label_CaptionAlignEnum.Enabled = ComboBox_CaptionAlignEnum.Enabled = true; CheckBox_ShowCaptionBarColor.Enabled = true; CheckBox_EnableCaptionBarTransparent.Enabled = true; CheckBox_ShowCaptionBarColor.Enabled = true; CheckBox_ShowShadowColor.Enabled = true; Label_BoundsSize.Enabled = TextBox_BoundsWidth.Enabled = TextBox_BoundsHeight.Enabled = true; Label_ImmersiveExperience.Enabled = false; // Panel_Main.Refresh(); UpdateUI(); } } }