/// <summary> /// Deletes all focus areas. /// </summary> private void DeleteAllFocusAreas() { List <FocusControl> controlsToDelete = new List <FocusControl>(); FocusControl.ForEach(this, (control) => { controlsToDelete.Add(control); }); controlsToDelete.ForEach((control) => { control.Delete(); }); }
// ******************************************************************** // Multiple Focus Controls // ******************************************************************** /// <summary> /// Counts the number of focus controls that have the specified owner. /// </summary> /// <param name="owner">The owner of the focus controls.</param> /// <returns>The number of focus controls.</returns> public static int GetCount(Control owner) { int count = 0; FocusControl.ForEach(owner, (control) => { count++; }); return(count); }
/// <summary> /// Saves the drape color, opacity, and the current focus areas to a CinemaDrape configuration file. /// </summary> /// <param name="filePath">The location of the configuration file.</param> /// <param name="saveAreas">True to save the current focus areas, false otherwise.</param> private void SaveLayout(string filePath, bool saveAreas) { VerySimpleIni iniFile = string.IsNullOrEmpty(filePath) ? new VerySimpleIni(Properties.Resources.StringDefaultSettingsFile, Application.ExecutablePath, Application.CompanyName, Application.ProductName, true) : new VerySimpleIni(filePath, true); if (iniFile.IsReady) { iniFile.SetValue(Properties.Resources.StringSettingsDrapeColor, ColorTranslator.ToHtml(this.BackColor)); int intlastUserOpacity = (int)(this.lastUserOpacity * 100); iniFile.SetValue(Properties.Resources.StringSettingsDrapeOpacity, intlastUserOpacity.ToString(CultureInfo.InvariantCulture)); iniFile.SetValue(Properties.Resources.StringSettingsHotkey, this.hotKeyString); int intPeekOpacity = (int)(this.peekOpacity * 100); iniFile.SetValue(Properties.Resources.StringSettingsPeekOpacity, intPeekOpacity.ToString(CultureInfo.InvariantCulture)); iniFile.SetValue(Properties.Resources.StringSettingsAutoRestoreAreas, this.autoRestoreAreas.ToString()); if (saveAreas) { FocusControl.ForEach( this, (control) => { iniFile.SetValue(Properties.Resources.StringSettingsFocusArea, new RectangleConverter().ConvertToInvariantString(control.RealBounds)); }); } iniFile.SetValue(Properties.Resources.StringSettingsShowQuickStart, this.quickStartForm.ShowAtStartupCheckBox.Checked.ToString()); iniFile.SetValue( Properties.Resources.StringSettingsQuickStartLocation, new PointConverter().ConvertToInvariantString(this.quickStartForm.Location)); try { iniFile.Save(); } catch { // Ignore configuration save errors } } }
/// <summary> /// Sets the new drape color, but first ensures it's different from the transparency key color value. /// </summary> /// <param name="color">The new color value for the drape.</param> private void SetDrapeColor(Color color) { this.BackColor = ColorsCommon.EnsureDifferentColor(color, this.TransparencyKey); // Ensure the color is different from the transparency color FocusControl.ForEach(this, (control) => { control.InitBorderPens(); }); // Reinitialize the border pens of each focus control this.Invalidate(true); // Force the redrawing of the drape }