123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- namespace OINA.Extender.Testharness
- {
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using OINA.Extender.Controls.Styles;
- /// <summary>
- /// The ElementCombo Visual settings form
- /// </summary>
- public partial class ElementComboVisualSettings : Form
- {
- /// <summary>
- /// Gets or sets the color of the ElementCombo background.
- /// </summary>
- private static Color BackgroundColor
- {
- get { return ColorConverter.Convert(ElementComboStyle.Background); }
- set { ElementComboStyle.Background = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Gets or sets the color of the ElementCombo foreground.
- /// </summary>
- private static Color ForegroundColor
- {
- get { return ColorConverter.Convert(ElementComboStyle.Foreground); }
- set { ElementComboStyle.Foreground = ColorConverter.Convert(value); }
- }
- /// <summary>
- /// Initializes a new instance of the <see cref="ElementComboVisualSettings"/> class.
- /// </summary>
- public ElementComboVisualSettings()
- {
- this.InitializeComponent();
- this.cbForegroundColor.DataSource = ColorConverter.GetSystemDrawingColors();
- this.cbBackgroundColor.DataSource = ColorConverter.GetSystemDrawingColors();
- this.cbFontSize.DataSource = new double[] { 8, 10, 12, 14, 16 };
- this.UpdateCombos();
- this.UpdatePanelColors();
- this.cbBackgroundColor.SelectedValueChanged += this.CbBackground_SelectedValueChanged;
- this.cbForegroundColor.SelectedValueChanged += this.CbForeground_SelectedValueChanged;
- this.cbFontSize.SelectedValueChanged += this.CbFontSize_SelectedValueChanged;
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the background combo.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void CbBackground_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.cbBackgroundColor.SelectedValue != null)
- {
- BackgroundColor = (Color)this.cbBackgroundColor.SelectedItem;
- this.UpdatePanelColors();
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the Foreground Combo.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void CbForeground_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.cbForegroundColor.SelectedValue != null)
- {
- ForegroundColor = (Color)this.cbForegroundColor.SelectedItem;
- this.UpdatePanelColors();
- }
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the Font Size combo.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void CbFontSize_SelectedValueChanged(object sender, EventArgs e)
- {
- if (this.cbFontSize.SelectedValue != null)
- {
- ElementComboStyle.ComboFontSize = (double)this.cbFontSize.SelectedValue;
- }
- }
- /// <summary>
- /// Updates the panel colors.
- /// </summary>
- private void UpdatePanelColors()
- {
- this.backgroundColorPanel.BackColor = BackgroundColor;
- this.foregroundColorPanel.BackColor = ForegroundColor;
- }
- /// <summary>
- /// Updates the combo values.
- /// </summary>
- private void UpdateCombos()
- {
- ColorConverter.PickColourComboItem(this.cbForegroundColor, ForegroundColor);
- ColorConverter.PickColourComboItem(this.cbBackgroundColor, BackgroundColor);
- this.cbFontSize.SelectedItem = ElementComboStyle.ComboFontSize;
- }
-
- /// <summary>
- /// Handles the ResetStyle button event.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void BtResetStyle_Click(object sender, EventArgs e)
- {
- ElementComboStyle.ResetStyles();
- this.UpdateCombos();
- this.UpdatePanelColors();
- }
- }
- }
|