/// <summary> /// Adds a new stored region. /// </summary> /// <param name="rectangle">Region bounds.</param> /// <param name="regionName">Name of the region.</param> /// <param name="isRelative">Whether the region is relative to the border.</param> private void StoreCurrentRegion(string regionName) { StoredRegion storedRegion = new StoredRegion(this.ConstructCurrentRegion(), regionName); int index = comboRegions.Items.Add(storedRegion); comboRegions.SelectedIndex = index; if (Settings.Default.SavedRegions == null) { Settings.Default.SavedRegions = new StoredRegionArray(); } Settings.Default.SavedRegions.Add(storedRegion); }
/// <summary> /// Sets the current selected region to a specific instance of a stored region. /// </summary> /// <param name="region">A stored region instance or null to reset.</param> public void SetRegion(StoredRegion region) { if (region == null) { Reset(); return; } SetRegion(region.Region); //Select right combobox if (comboRegions.Items.Contains(region)) { comboRegions.SelectedItem = region; } }
/// <summary> /// Adds a new stored region. /// </summary> /// <param name="rectangle">Region bounds.</param> /// <param name="regionName">Name of the region.</param> /// <param name="isRelative">Whether the region is relative to the border.</param> private void StoreCurrentRegion(string regionName) { StoredRegion storedRegion = new StoredRegion(this.ConstructCurrentRegion(), regionName); int index = comboRegions.Items.Add(storedRegion); comboRegions.SelectedIndex = index; if (Settings.Default.SavedRegions == null) Settings.Default.SavedRegions = new StoredRegionArray(); Settings.Default.SavedRegions.Add(storedRegion); }
/// <summary> /// Adds a new stored region. /// </summary> /// <param name="rectangle">Region bounds.</param> /// <param name="regionName">Name of the region.</param> private void AddRegion(Rectangle rectangle, string regionName) { var region = new StoredRegion(rectangle, regionName); int index = comboRegions.Items.Add(region); comboRegions.SelectedIndex = index; if (Settings.Default.SavedRegions == null) Settings.Default.SavedRegions = new StoredRegionArray(); Settings.Default.SavedRegions.Add(region); }