// Show Color Dialog to change the cell color setting private void buttonCellColor_Click(object sender, EventArgs e) { // Create an instance of ColorDialog ColorDialog dlg = new ColorDialog(); // Pass in the button's backcolor dlg.Color = buttonCellColor.BackColor; // Show the color dialog if (DialogResult.OK == dlg.ShowDialog()) { // Get user's setting and save it to the button's backcolor property buttonCellColor.BackColor = dlg.Color; // Set button's forecolor to its backcolor's bitwise complement buttonCellColor.ForeColor = Color.FromArgb(~(dlg.Color.ToArgb())); // Invalidate preview panel to redraw preview PreviewGraphicsPanel.Invalidate(); } }
// Restore all settings to defaults private void defaultsButton_Click(object sender, EventArgs e) { // Finite Mode Finite = false; // Rows NumberOfRows = 25; // Columns NumberOfColumns = 25; // Time Interval Interval = 1; // Background Color Background = Color.Wheat; // Grid Color GridColor = Color.Red; // Cell Color CellsColor = Color.Navy; // Show Grid ShowGrid = true; // Gridline Width LineWidth = -2; // Invalidate to redraw PreviewGraphicsPanel.Invalidate(); }
// When Line Width setting changes, Invalidate the preview panel to redraw preview private void numericUpDownLineWidth_ValueChanged(object sender, EventArgs e) { PreviewGraphicsPanel.Invalidate(); }
// When Show Grid setting changes, Invalidate the preview panel to redraw preview private void checkBoxShowGrid_CheckedChanged(object sender, EventArgs e) { PreviewGraphicsPanel.Invalidate(); }
// OptionsDialog Form initialization // public OptionsDialog() { InitializeComponent(); PreviewGraphicsPanel.Invalidate(); }