math-suite/Source/MatrixCalculator/Forms/SettingsWindow.cs

61 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MatrixCalculator
{
public partial class SettingsWindow : Form
{
public SettingsWindow()
{
InitializeComponent();
// Get settings
int prec = MatrixCalculator.Properties.Settings.Default.DoublePrecision;
bool res = MatrixCalculator.Properties.Settings.Default.NumberResultAsMatrix;
// Show settings
if (prec == -1) checkDoublePrecision.Checked = false;
else
{
checkDoublePrecision.Checked = true;
inputDoublePrecision.Value = prec;
}
checkResultAsMatrix.Checked = res;
}
private void checkDoublePrecision_CheckedChanged(object sender, EventArgs e)
{
inputDoublePrecision.Enabled = checkDoublePrecision.Checked;
}
private void buttonAccept_Click(object sender, EventArgs e)
{
if (!checkDoublePrecision.Checked) MatrixCalculator.Properties.Settings.Default.DoublePrecision = -1;
else MatrixCalculator.Properties.Settings.Default.DoublePrecision = Convert.ToInt32(inputDoublePrecision.Value);
MatrixCalculator.Properties.Settings.Default.NumberResultAsMatrix = checkResultAsMatrix.Checked;
this.Close();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.Close();
}
#region Paint
protected override void OnPaintBackground(PaintEventArgs e)
{
DynamicLink.Controls.BackgroundGradient.Paint(e.Graphics, new Rectangle(-1, -1, this.Width, this.Height));
}
#endregion
}
}