Added source code.

This commit is contained in:
2018-02-06 01:24:46 +02:00
parent 1d9f2990c8
commit 8b28da5b80
367 changed files with 22964 additions and 0 deletions

View File

@ -0,0 +1,454 @@
namespace MatrixCalculator
{
partial class Editor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.dataEditorContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.contextMenuCut = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuCopy = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuPaste = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.contextMenuClear = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuClearAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.contextMenuInsertRow = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuInsertCol = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuDelRow = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuDelColumn = new System.Windows.Forms.ToolStripMenuItem();
this.groupSize = new DynamicLink.Controls.MyGroupBox();
this.buttonResizeReset = new DynamicLink.Controls.MyButton();
this.labelWarning = new System.Windows.Forms.Label();
this.buttonResizeApply = new DynamicLink.Controls.MyButton();
this.labelColumns = new System.Windows.Forms.Label();
this.labelRows = new System.Windows.Forms.Label();
this.inputColumns = new System.Windows.Forms.NumericUpDown();
this.inputRows = new System.Windows.Forms.NumericUpDown();
this.groupInfo = new DynamicLink.Controls.MyGroupBox();
this.inputDescription = new System.Windows.Forms.TextBox();
this.inputName = new System.Windows.Forms.TextBox();
this.labelDescription = new System.Windows.Forms.Label();
this.labelName = new System.Windows.Forms.Label();
this.buttonAccept = new DynamicLink.Controls.MyButton();
this.buttonCancel = new DynamicLink.Controls.MyButton();
this.groupBoxMatrixData = new DynamicLink.Controls.MyGroupBox();
this.dataEditor = new System.Windows.Forms.DataGridView();
this.dataEditorContextMenu.SuspendLayout();
this.groupSize.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.inputColumns)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.inputRows)).BeginInit();
this.groupInfo.SuspendLayout();
this.groupBoxMatrixData.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataEditor)).BeginInit();
this.SuspendLayout();
//
// dataEditorContextMenu
//
this.dataEditorContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.contextMenuCut,
this.contextMenuCopy,
this.contextMenuPaste,
this.toolStripSeparator1,
this.contextMenuClear,
this.contextMenuClearAll,
this.toolStripSeparator2,
this.contextMenuInsertRow,
this.contextMenuInsertCol,
this.contextMenuDelRow,
this.contextMenuDelColumn});
this.dataEditorContextMenu.Name = "dataEditorContextMenu";
this.dataEditorContextMenu.Size = new System.Drawing.Size(226, 214);
//
// contextMenuCut
//
this.contextMenuCut.Name = "contextMenuCut";
this.contextMenuCut.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.contextMenuCut.Size = new System.Drawing.Size(225, 22);
this.contextMenuCut.Text = "Cu&t";
this.contextMenuCut.Click += new System.EventHandler(this.contextMenuCut_Click);
//
// contextMenuCopy
//
this.contextMenuCopy.Name = "contextMenuCopy";
this.contextMenuCopy.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.contextMenuCopy.Size = new System.Drawing.Size(225, 22);
this.contextMenuCopy.Text = "&Copy";
this.contextMenuCopy.Click += new System.EventHandler(this.contextMenuCopy_Click);
//
// contextMenuPaste
//
this.contextMenuPaste.Name = "contextMenuPaste";
this.contextMenuPaste.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.contextMenuPaste.Size = new System.Drawing.Size(225, 22);
this.contextMenuPaste.Text = "&Paste";
this.contextMenuPaste.Click += new System.EventHandler(this.contextMenuPaste_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(222, 6);
//
// contextMenuClear
//
this.contextMenuClear.Name = "contextMenuClear";
this.contextMenuClear.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.contextMenuClear.Size = new System.Drawing.Size(225, 22);
this.contextMenuClear.Text = "&Clear selected";
this.contextMenuClear.Click += new System.EventHandler(this.contextMenuClear_Click);
//
// contextMenuClearAll
//
this.contextMenuClearAll.Name = "contextMenuClearAll";
this.contextMenuClearAll.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.Delete)));
this.contextMenuClearAll.Size = new System.Drawing.Size(225, 22);
this.contextMenuClearAll.Text = "Clear &all";
this.contextMenuClearAll.Click += new System.EventHandler(this.contextMenuClearAll_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(222, 6);
//
// contextMenuInsertRow
//
this.contextMenuInsertRow.Name = "contextMenuInsertRow";
this.contextMenuInsertRow.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt)
| System.Windows.Forms.Keys.R)));
this.contextMenuInsertRow.Size = new System.Drawing.Size(225, 22);
this.contextMenuInsertRow.Text = "Insert row";
this.contextMenuInsertRow.Click += new System.EventHandler(this.contextMenuInsertRow_Click);
//
// contextMenuInsertCol
//
this.contextMenuInsertCol.Name = "contextMenuInsertCol";
this.contextMenuInsertCol.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt)
| System.Windows.Forms.Keys.C)));
this.contextMenuInsertCol.Size = new System.Drawing.Size(225, 22);
this.contextMenuInsertCol.Text = "Insert column";
this.contextMenuInsertCol.Click += new System.EventHandler(this.contextMenuInsertCol_Click);
//
// contextMenuDelRow
//
this.contextMenuDelRow.Name = "contextMenuDelRow";
this.contextMenuDelRow.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.R)));
this.contextMenuDelRow.Size = new System.Drawing.Size(225, 22);
this.contextMenuDelRow.Text = "Delete row";
this.contextMenuDelRow.Click += new System.EventHandler(this.contextMenuDelRow_Click);
//
// contextMenuDelColumn
//
this.contextMenuDelColumn.Name = "contextMenuDelColumn";
this.contextMenuDelColumn.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.C)));
this.contextMenuDelColumn.Size = new System.Drawing.Size(225, 22);
this.contextMenuDelColumn.Text = "Delete column";
this.contextMenuDelColumn.Click += new System.EventHandler(this.contextMenuDelColumn_Click);
//
// groupSize
//
this.groupSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupSize.BackColor = System.Drawing.Color.Transparent;
this.groupSize.Controls.Add(this.buttonResizeReset);
this.groupSize.Controls.Add(this.labelWarning);
this.groupSize.Controls.Add(this.buttonResizeApply);
this.groupSize.Controls.Add(this.labelColumns);
this.groupSize.Controls.Add(this.labelRows);
this.groupSize.Controls.Add(this.inputColumns);
this.groupSize.Controls.Add(this.inputRows);
this.groupSize.Location = new System.Drawing.Point(382, 135);
this.groupSize.Name = "groupSize";
this.groupSize.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupSize.Size = new System.Drawing.Size(192, 153);
this.groupSize.TabIndex = 1;
this.groupSize.TabStop = false;
this.groupSize.Text = "Matrix size:";
//
// buttonResizeReset
//
this.buttonResizeReset.BackColor = System.Drawing.Color.Transparent;
this.buttonResizeReset.Location = new System.Drawing.Point(6, 124);
this.buttonResizeReset.Name = "buttonResizeReset";
this.buttonResizeReset.Size = new System.Drawing.Size(87, 23);
this.buttonResizeReset.TabIndex = 6;
this.buttonResizeReset.Text = "Reset";
this.buttonResizeReset.UseVisualStyleBackColor = false;
this.buttonResizeReset.Click += new System.EventHandler(this.buttonResizeReset_Click);
//
// labelWarning
//
this.labelWarning.Location = new System.Drawing.Point(6, 87);
this.labelWarning.Name = "labelWarning";
this.labelWarning.Size = new System.Drawing.Size(180, 27);
this.labelWarning.TabIndex = 5;
this.labelWarning.Text = "Warning: removing rows or columns will delete the data contained.";
//
// buttonResizeApply
//
this.buttonResizeApply.BackColor = System.Drawing.Color.Transparent;
this.buttonResizeApply.Location = new System.Drawing.Point(99, 124);
this.buttonResizeApply.Name = "buttonResizeApply";
this.buttonResizeApply.Size = new System.Drawing.Size(87, 23);
this.buttonResizeApply.TabIndex = 4;
this.buttonResizeApply.Text = "Apply";
this.buttonResizeApply.UseVisualStyleBackColor = false;
this.buttonResizeApply.Click += new System.EventHandler(this.buttonResizeApply_Click);
//
// labelColumns
//
this.labelColumns.AutoSize = true;
this.labelColumns.Location = new System.Drawing.Point(6, 57);
this.labelColumns.Name = "labelColumns";
this.labelColumns.Size = new System.Drawing.Size(50, 13);
this.labelColumns.TabIndex = 3;
this.labelColumns.Text = "Columns:";
//
// labelRows
//
this.labelRows.AutoSize = true;
this.labelRows.Location = new System.Drawing.Point(6, 31);
this.labelRows.Name = "labelRows";
this.labelRows.Size = new System.Drawing.Size(37, 13);
this.labelRows.TabIndex = 2;
this.labelRows.Text = "Rows:";
//
// inputColumns
//
this.inputColumns.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.inputColumns.Location = new System.Drawing.Point(90, 55);
this.inputColumns.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.inputColumns.Name = "inputColumns";
this.inputColumns.Size = new System.Drawing.Size(94, 20);
this.inputColumns.TabIndex = 1;
this.inputColumns.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// inputRows
//
this.inputRows.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.inputRows.Location = new System.Drawing.Point(90, 29);
this.inputRows.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.inputRows.Name = "inputRows";
this.inputRows.Size = new System.Drawing.Size(94, 20);
this.inputRows.TabIndex = 0;
this.inputRows.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// groupInfo
//
this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupInfo.BackColor = System.Drawing.Color.Transparent;
this.groupInfo.Controls.Add(this.inputDescription);
this.groupInfo.Controls.Add(this.inputName);
this.groupInfo.Controls.Add(this.labelDescription);
this.groupInfo.Controls.Add(this.labelName);
this.groupInfo.Location = new System.Drawing.Point(382, 13);
this.groupInfo.Name = "groupInfo";
this.groupInfo.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupInfo.Size = new System.Drawing.Size(192, 116);
this.groupInfo.TabIndex = 2;
this.groupInfo.TabStop = false;
this.groupInfo.Text = "Matrix info:";
//
// inputDescription
//
this.inputDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.inputDescription.Location = new System.Drawing.Point(6, 67);
this.inputDescription.Multiline = true;
this.inputDescription.Name = "inputDescription";
this.inputDescription.Size = new System.Drawing.Size(178, 43);
this.inputDescription.TabIndex = 7;
//
// inputName
//
this.inputName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.inputName.Location = new System.Drawing.Point(50, 22);
this.inputName.Name = "inputName";
this.inputName.Size = new System.Drawing.Size(134, 20);
this.inputName.TabIndex = 6;
//
// labelDescription
//
this.labelDescription.AutoSize = true;
this.labelDescription.Location = new System.Drawing.Point(6, 51);
this.labelDescription.Name = "labelDescription";
this.labelDescription.Size = new System.Drawing.Size(63, 13);
this.labelDescription.TabIndex = 5;
this.labelDescription.Text = "Description:";
//
// labelName
//
this.labelName.AutoSize = true;
this.labelName.Location = new System.Drawing.Point(6, 25);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(38, 13);
this.labelName.TabIndex = 4;
this.labelName.Text = "Name:";
//
// buttonAccept
//
this.buttonAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAccept.BackColor = System.Drawing.Color.Transparent;
this.buttonAccept.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonAccept.ForeColor = System.Drawing.Color.DarkGreen;
this.buttonAccept.Location = new System.Drawing.Point(490, 327);
this.buttonAccept.Name = "buttonAccept";
this.buttonAccept.Size = new System.Drawing.Size(84, 29);
this.buttonAccept.TabIndex = 8;
this.buttonAccept.Text = "Accept";
this.buttonAccept.UseVisualStyleBackColor = false;
this.buttonAccept.Click += new System.EventHandler(this.buttonAccept_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.BackColor = System.Drawing.Color.Transparent;
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(400, 327);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(84, 29);
this.buttonCancel.TabIndex = 7;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = false;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// groupBoxMatrixData
//
this.groupBoxMatrixData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxMatrixData.BackColor = System.Drawing.Color.Transparent;
this.groupBoxMatrixData.Controls.Add(this.dataEditor);
this.groupBoxMatrixData.Location = new System.Drawing.Point(12, 13);
this.groupBoxMatrixData.Name = "groupBoxMatrixData";
this.groupBoxMatrixData.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupBoxMatrixData.Size = new System.Drawing.Size(364, 343);
this.groupBoxMatrixData.TabIndex = 9;
this.groupBoxMatrixData.TabStop = false;
this.groupBoxMatrixData.Text = "Matrix data";
//
// dataEditor
//
this.dataEditor.AllowUserToAddRows = false;
this.dataEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataEditor.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataEditor.ContextMenuStrip = this.dataEditorContextMenu;
this.dataEditor.Location = new System.Drawing.Point(3, 21);
this.dataEditor.Name = "dataEditor";
this.dataEditor.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
this.dataEditor.Size = new System.Drawing.Size(358, 319);
this.dataEditor.TabIndex = 1;
this.dataEditor.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataEditor_CellMouseDown);
//
// Editor
//
this.AcceptButton = this.buttonAccept;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(586, 368);
this.Controls.Add(this.groupBoxMatrixData);
this.Controls.Add(this.buttonAccept);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.groupInfo);
this.Controls.Add(this.groupSize);
this.HelpButton = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Editor";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Editor";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Editor_FormClosing);
this.dataEditorContextMenu.ResumeLayout(false);
this.groupSize.ResumeLayout(false);
this.groupSize.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.inputColumns)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.inputRows)).EndInit();
this.groupInfo.ResumeLayout(false);
this.groupInfo.PerformLayout();
this.groupBoxMatrixData.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataEditor)).EndInit();
this.ResumeLayout(false);
}
#endregion
private DynamicLink.Controls.MyGroupBox groupSize;
private DynamicLink.Controls.MyButton buttonResizeApply;
private System.Windows.Forms.Label labelColumns;
private System.Windows.Forms.Label labelRows;
private System.Windows.Forms.NumericUpDown inputColumns;
private System.Windows.Forms.NumericUpDown inputRows;
private DynamicLink.Controls.MyButton buttonResizeReset;
private System.Windows.Forms.Label labelWarning;
private DynamicLink.Controls.MyGroupBox groupInfo;
private System.Windows.Forms.TextBox inputDescription;
private System.Windows.Forms.TextBox inputName;
private System.Windows.Forms.Label labelDescription;
private System.Windows.Forms.Label labelName;
private DynamicLink.Controls.MyButton buttonAccept;
private DynamicLink.Controls.MyButton buttonCancel;
private System.Windows.Forms.ContextMenuStrip dataEditorContextMenu;
private System.Windows.Forms.ToolStripMenuItem contextMenuCut;
private System.Windows.Forms.ToolStripMenuItem contextMenuCopy;
private System.Windows.Forms.ToolStripMenuItem contextMenuPaste;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem contextMenuClear;
private System.Windows.Forms.ToolStripMenuItem contextMenuClearAll;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem contextMenuInsertRow;
private System.Windows.Forms.ToolStripMenuItem contextMenuInsertCol;
private System.Windows.Forms.ToolStripMenuItem contextMenuDelRow;
private System.Windows.Forms.ToolStripMenuItem contextMenuDelColumn;
private DynamicLink.Controls.MyGroupBox groupBoxMatrixData;
private System.Windows.Forms.DataGridView dataEditor;
}
}

View File

@ -0,0 +1,181 @@
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;
using MathNet.Numerics.LinearAlgebra;
namespace MatrixCalculator
{
public partial class Editor : Form
{
bool allowExit = true;
#region Setters and getters
public string MatrixName {
get { return inputName.Text; }
set { inputName.Text = value; }
}
public string MatrixDescription
{
get { return inputDescription.Text; }
set { inputDescription.Text = value; }
}
public Matrix<double> Matrix
{
get { return GridViewHelper.GetMatrix(dataEditor); }
set {
GridViewHelper.PutMatrix(value, dataEditor);
inputColumns.Value = value.ColumnCount;
inputRows.Value = value.RowCount;
}
}
#endregion
#region Constructor
public Editor()
{
InitializeComponent();
inputName.Text = "New matrix ";
}
#endregion
#region Resize buttons
private void buttonResizeReset_Click(object sender, EventArgs e)
{
inputRows.Value = dataEditor.Rows.Count;
inputColumns.Value = dataEditor.Columns.Count;
}
private void buttonResizeApply_Click(object sender, EventArgs e)
{
int rows = Convert.ToInt32(inputRows.Value);
int cols = Convert.ToInt32(inputColumns.Value);
GridViewHelper.Resize(dataEditor, cols, rows);
}
#endregion
#region Form buttons
private void buttonAccept_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
// Make sure name is not empty
if (MatrixName == "")
{
allowExit = false;
MessageBox.Show("You must enter a name!", "Error!");
}
// Make sure size is not empty! Empty matrices behave very weird
else if (dataEditor.Columns.Count == 0 || dataEditor.Rows.Count == 0)
{
allowExit = false;
MessageBox.Show("The matrix must have at least one row and one column!", "Error!");
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
#endregion
#region Right click menu
private void contextMenuCut_Click(object sender, EventArgs e)
{
GridViewHelper.CopySelected(dataEditor);
foreach (DataGridViewCell i in dataEditor.SelectedCells) i.Value = "0";
}
private void contextMenuCopy_Click(object sender, EventArgs e)
{
GridViewHelper.CopySelected(dataEditor);
}
private void contextMenuPaste_Click(object sender, EventArgs e)
{
GridViewHelper.Paste(dataEditor);
}
private void contextMenuClear_Click(object sender, EventArgs e)
{
foreach (DataGridViewCell i in dataEditor.SelectedCells) i.Value = "0";
}
private void contextMenuClearAll_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow i in dataEditor.Rows)
foreach (DataGridViewCell j in i.Cells)
j.Value = "0";
}
private void contextMenuInsertRow_Click(object sender, EventArgs e)
{
if (dataEditor.CurrentCell != null) dataEditor.Rows.Insert(dataEditor.CurrentCell.RowIndex, new DataGridViewRow());
else dataEditor.Rows.Add();
}
private void contextMenuInsertCol_Click(object sender, EventArgs e)
{
var col = new DataGridViewTextBoxColumn()
{
SortMode = DataGridViewColumnSortMode.NotSortable,
AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader
};
if (dataEditor.CurrentCell != null) dataEditor.Columns.Insert(dataEditor.CurrentCell.ColumnIndex, col);
else dataEditor.Columns.Add(col);
}
private void contextMenuDelRow_Click(object sender, EventArgs e)
{
foreach (DataGridViewCell i in dataEditor.SelectedCells)
dataEditor.Rows.RemoveAt(i.RowIndex);
}
private void contextMenuDelColumn_Click(object sender, EventArgs e)
{
foreach (DataGridViewCell i in dataEditor.SelectedCells)
dataEditor.Columns.RemoveAt(i.ColumnIndex);
}
#endregion
#region Drawing
protected override void OnPaintBackground(PaintEventArgs e)
{
DynamicLink.Controls.BackgroundGradient.Paint(e.Graphics, new Rectangle(-1, -1, this.Width, this.Height));
}
#endregion
private void dataEditor_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.ColumnIndex < 0 || e.ColumnIndex >= dataEditor.Columns.Count) return;
if (e.RowIndex < 0 || e.RowIndex >= dataEditor.Rows.Count) return;
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
dataEditor.CurrentCell = dataEditor.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (dataEditor.ContextMenu != null) dataEditor.ContextMenu.Show(dataEditor, e.Location);
}
}
private void Editor_FormClosing(object sender, FormClosingEventArgs e)
{
if (!allowExit)
{
allowExit = true;
e.Cancel = true;
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="dataEditorContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,455 @@
namespace MatrixCalculator
{
partial class ImportCsvWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonAccept = new DynamicLink.Controls.MyButton();
this.buttonCancel = new DynamicLink.Controls.MyButton();
this.buttonEntire = new DynamicLink.Controls.MyButton();
this.labelSepChars = new System.Windows.Forms.Label();
this.checkSepComma = new System.Windows.Forms.CheckBox();
this.checkSepSemicolon = new System.Windows.Forms.CheckBox();
this.checkSepTab = new System.Windows.Forms.CheckBox();
this.checkSepSpace = new System.Windows.Forms.CheckBox();
this.checkSepOthers = new System.Windows.Forms.CheckBox();
this.inputSepOthers = new System.Windows.Forms.TextBox();
this.checkCombine = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBoxSelectRange = new DynamicLink.Controls.MyGroupBox();
this.dataGrid = new System.Windows.Forms.DataGridView();
this.groupBoxMatrixName = new DynamicLink.Controls.MyGroupBox();
this.inputName = new System.Windows.Forms.TextBox();
this.groupBoxRange = new DynamicLink.Controls.MyGroupBox();
this.labelEndColumn = new System.Windows.Forms.Label();
this.inputEndColumn = new System.Windows.Forms.NumericUpDown();
this.labelEndRow = new System.Windows.Forms.Label();
this.inputEndRow = new System.Windows.Forms.NumericUpDown();
this.labelStartColumn = new System.Windows.Forms.Label();
this.inputStartColumn = new System.Windows.Forms.NumericUpDown();
this.labelStartRow = new System.Windows.Forms.Label();
this.inputStartRow = new System.Windows.Forms.NumericUpDown();
this.groupBoxSeparators = new DynamicLink.Controls.MyGroupBox();
this.groupBoxSelectRange.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
this.groupBoxMatrixName.SuspendLayout();
this.groupBoxRange.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.inputEndColumn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.inputEndRow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.inputStartColumn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.inputStartRow)).BeginInit();
this.groupBoxSeparators.SuspendLayout();
this.SuspendLayout();
//
// buttonAccept
//
this.buttonAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAccept.BackColor = System.Drawing.Color.Transparent;
this.buttonAccept.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonAccept.ForeColor = System.Drawing.Color.DarkGreen;
this.buttonAccept.Location = new System.Drawing.Point(426, 401);
this.buttonAccept.Name = "buttonAccept";
this.buttonAccept.Size = new System.Drawing.Size(75, 23);
this.buttonAccept.TabIndex = 5;
this.buttonAccept.Text = "Accept ";
this.buttonAccept.UseVisualStyleBackColor = false;
this.buttonAccept.Click += new System.EventHandler(this.buttonAccept_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.BackColor = System.Drawing.Color.Transparent;
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(345, 401);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 4;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = false;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// buttonEntire
//
this.buttonEntire.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonEntire.BackColor = System.Drawing.Color.Transparent;
this.buttonEntire.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonEntire.Location = new System.Drawing.Point(8, 401);
this.buttonEntire.Name = "buttonEntire";
this.buttonEntire.Size = new System.Drawing.Size(75, 23);
this.buttonEntire.TabIndex = 6;
this.buttonEntire.Text = "Entire grid";
this.buttonEntire.UseVisualStyleBackColor = false;
this.buttonEntire.Click += new System.EventHandler(this.buttonEntire_Click);
//
// labelSepChars
//
this.labelSepChars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelSepChars.AutoSize = true;
this.labelSepChars.BackColor = System.Drawing.Color.Transparent;
this.labelSepChars.Location = new System.Drawing.Point(6, 28);
this.labelSepChars.Name = "labelSepChars";
this.labelSepChars.Size = new System.Drawing.Size(85, 13);
this.labelSepChars.TabIndex = 15;
this.labelSepChars.Text = "Separator chars:";
//
// checkSepComma
//
this.checkSepComma.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkSepComma.AutoSize = true;
this.checkSepComma.BackColor = System.Drawing.Color.Transparent;
this.checkSepComma.Checked = true;
this.checkSepComma.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkSepComma.Location = new System.Drawing.Point(28, 69);
this.checkSepComma.Margin = new System.Windows.Forms.Padding(2);
this.checkSepComma.Name = "checkSepComma";
this.checkSepComma.Size = new System.Drawing.Size(61, 17);
this.checkSepComma.TabIndex = 16;
this.checkSepComma.Text = "Comma";
this.checkSepComma.UseVisualStyleBackColor = false;
this.checkSepComma.CheckedChanged += new System.EventHandler(this.checkSepComma_CheckedChanged);
//
// checkSepSemicolon
//
this.checkSepSemicolon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkSepSemicolon.AutoSize = true;
this.checkSepSemicolon.BackColor = System.Drawing.Color.Transparent;
this.checkSepSemicolon.Location = new System.Drawing.Point(28, 90);
this.checkSepSemicolon.Margin = new System.Windows.Forms.Padding(2);
this.checkSepSemicolon.Name = "checkSepSemicolon";
this.checkSepSemicolon.Size = new System.Drawing.Size(75, 17);
this.checkSepSemicolon.TabIndex = 17;
this.checkSepSemicolon.Text = "Semicolon";
this.checkSepSemicolon.UseVisualStyleBackColor = false;
this.checkSepSemicolon.CheckedChanged += new System.EventHandler(this.checkSepSemicolon_CheckedChanged);
//
// checkSepTab
//
this.checkSepTab.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkSepTab.AutoSize = true;
this.checkSepTab.BackColor = System.Drawing.Color.Transparent;
this.checkSepTab.Location = new System.Drawing.Point(28, 48);
this.checkSepTab.Margin = new System.Windows.Forms.Padding(2);
this.checkSepTab.Name = "checkSepTab";
this.checkSepTab.Size = new System.Drawing.Size(45, 17);
this.checkSepTab.TabIndex = 18;
this.checkSepTab.Text = "Tab";
this.checkSepTab.UseVisualStyleBackColor = false;
this.checkSepTab.CheckedChanged += new System.EventHandler(this.checkSepTab_CheckedChanged);
//
// checkSepSpace
//
this.checkSepSpace.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkSepSpace.AutoSize = true;
this.checkSepSpace.BackColor = System.Drawing.Color.Transparent;
this.checkSepSpace.Location = new System.Drawing.Point(28, 111);
this.checkSepSpace.Margin = new System.Windows.Forms.Padding(2);
this.checkSepSpace.Name = "checkSepSpace";
this.checkSepSpace.Size = new System.Drawing.Size(57, 17);
this.checkSepSpace.TabIndex = 19;
this.checkSepSpace.Text = "Space";
this.checkSepSpace.UseVisualStyleBackColor = false;
this.checkSepSpace.CheckedChanged += new System.EventHandler(this.checkSepSpace_CheckedChanged);
//
// checkSepOthers
//
this.checkSepOthers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkSepOthers.AutoSize = true;
this.checkSepOthers.BackColor = System.Drawing.Color.Transparent;
this.checkSepOthers.Location = new System.Drawing.Point(28, 132);
this.checkSepOthers.Margin = new System.Windows.Forms.Padding(2);
this.checkSepOthers.Name = "checkSepOthers";
this.checkSepOthers.Size = new System.Drawing.Size(60, 17);
this.checkSepOthers.TabIndex = 20;
this.checkSepOthers.Text = "Others:";
this.checkSepOthers.UseVisualStyleBackColor = false;
this.checkSepOthers.CheckedChanged += new System.EventHandler(this.checkSepOthers_CheckedChanged);
//
// inputSepOthers
//
this.inputSepOthers.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.inputSepOthers.Location = new System.Drawing.Point(93, 130);
this.inputSepOthers.Name = "inputSepOthers";
this.inputSepOthers.Size = new System.Drawing.Size(59, 20);
this.inputSepOthers.TabIndex = 21;
this.inputSepOthers.TextChanged += new System.EventHandler(this.inputSepOthers_TextChanged);
//
// checkCombine
//
this.checkCombine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkCombine.AutoSize = true;
this.checkCombine.BackColor = System.Drawing.Color.Transparent;
this.checkCombine.Location = new System.Drawing.Point(9, 165);
this.checkCombine.Margin = new System.Windows.Forms.Padding(2);
this.checkCombine.Name = "checkCombine";
this.checkCombine.Size = new System.Drawing.Size(120, 17);
this.checkCombine.TabIndex = 22;
this.checkCombine.Text = "Combine characters";
this.checkCombine.UseVisualStyleBackColor = false;
this.checkCombine.CheckedChanged += new System.EventHandler(this.checkCombine_CheckedChanged);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(355, 36);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13);
this.label1.TabIndex = 24;
this.label1.Text = "Name:";
//
// groupBoxSelectRange
//
this.groupBoxSelectRange.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSelectRange.BackColor = System.Drawing.Color.Transparent;
this.groupBoxSelectRange.Controls.Add(this.dataGrid);
this.groupBoxSelectRange.Location = new System.Drawing.Point(12, 12);
this.groupBoxSelectRange.Name = "groupBoxSelectRange";
this.groupBoxSelectRange.Padding = new System.Windows.Forms.Padding(4, 9, 4, 4);
this.groupBoxSelectRange.Size = new System.Drawing.Size(326, 383);
this.groupBoxSelectRange.TabIndex = 25;
this.groupBoxSelectRange.TabStop = false;
this.groupBoxSelectRange.Text = "Matrix data";
//
// dataGrid
//
this.dataGrid.AllowUserToAddRows = false;
this.dataGrid.AllowUserToDeleteRows = false;
this.dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid.Location = new System.Drawing.Point(4, 22);
this.dataGrid.Name = "dataGrid";
this.dataGrid.ReadOnly = true;
this.dataGrid.Size = new System.Drawing.Size(318, 357);
this.dataGrid.TabIndex = 1;
//
// groupBoxMatrixName
//
this.groupBoxMatrixName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxMatrixName.BackColor = System.Drawing.Color.Transparent;
this.groupBoxMatrixName.Controls.Add(this.inputName);
this.groupBoxMatrixName.Location = new System.Drawing.Point(344, 12);
this.groupBoxMatrixName.Name = "groupBoxMatrixName";
this.groupBoxMatrixName.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupBoxMatrixName.Size = new System.Drawing.Size(158, 49);
this.groupBoxMatrixName.TabIndex = 26;
this.groupBoxMatrixName.TabStop = false;
this.groupBoxMatrixName.Text = "Name";
//
// inputName
//
this.inputName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.inputName.Location = new System.Drawing.Point(6, 24);
this.inputName.Name = "inputName";
this.inputName.Size = new System.Drawing.Size(146, 20);
this.inputName.TabIndex = 24;
this.inputName.Text = "Imported ";
//
// groupBoxRange
//
this.groupBoxRange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxRange.BackColor = System.Drawing.Color.Transparent;
this.groupBoxRange.Controls.Add(this.labelEndColumn);
this.groupBoxRange.Controls.Add(this.inputEndColumn);
this.groupBoxRange.Controls.Add(this.labelEndRow);
this.groupBoxRange.Controls.Add(this.inputEndRow);
this.groupBoxRange.Controls.Add(this.labelStartColumn);
this.groupBoxRange.Controls.Add(this.inputStartColumn);
this.groupBoxRange.Controls.Add(this.labelStartRow);
this.groupBoxRange.Controls.Add(this.inputStartRow);
this.groupBoxRange.Location = new System.Drawing.Point(344, 67);
this.groupBoxRange.Name = "groupBoxRange";
this.groupBoxRange.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupBoxRange.Size = new System.Drawing.Size(158, 132);
this.groupBoxRange.TabIndex = 27;
this.groupBoxRange.TabStop = false;
this.groupBoxRange.Text = "Range";
//
// labelEndColumn
//
this.labelEndColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelEndColumn.AutoSize = true;
this.labelEndColumn.BackColor = System.Drawing.Color.Transparent;
this.labelEndColumn.Location = new System.Drawing.Point(6, 104);
this.labelEndColumn.Name = "labelEndColumn";
this.labelEndColumn.Size = new System.Drawing.Size(66, 13);
this.labelEndColumn.TabIndex = 22;
this.labelEndColumn.Text = "End column:";
//
// inputEndColumn
//
this.inputEndColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.inputEndColumn.Location = new System.Drawing.Point(96, 102);
this.inputEndColumn.Name = "inputEndColumn";
this.inputEndColumn.Size = new System.Drawing.Size(56, 20);
this.inputEndColumn.TabIndex = 21;
//
// labelEndRow
//
this.labelEndRow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelEndRow.AutoSize = true;
this.labelEndRow.BackColor = System.Drawing.Color.Transparent;
this.labelEndRow.Location = new System.Drawing.Point(6, 78);
this.labelEndRow.Name = "labelEndRow";
this.labelEndRow.Size = new System.Drawing.Size(49, 13);
this.labelEndRow.TabIndex = 20;
this.labelEndRow.Text = "End row:";
//
// inputEndRow
//
this.inputEndRow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.inputEndRow.Location = new System.Drawing.Point(96, 76);
this.inputEndRow.Name = "inputEndRow";
this.inputEndRow.Size = new System.Drawing.Size(56, 20);
this.inputEndRow.TabIndex = 19;
//
// labelStartColumn
//
this.labelStartColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelStartColumn.AutoSize = true;
this.labelStartColumn.BackColor = System.Drawing.Color.Transparent;
this.labelStartColumn.Location = new System.Drawing.Point(6, 52);
this.labelStartColumn.Name = "labelStartColumn";
this.labelStartColumn.Size = new System.Drawing.Size(69, 13);
this.labelStartColumn.TabIndex = 18;
this.labelStartColumn.Text = "Start column:";
//
// inputStartColumn
//
this.inputStartColumn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.inputStartColumn.Location = new System.Drawing.Point(96, 50);
this.inputStartColumn.Name = "inputStartColumn";
this.inputStartColumn.Size = new System.Drawing.Size(56, 20);
this.inputStartColumn.TabIndex = 17;
//
// labelStartRow
//
this.labelStartRow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelStartRow.AutoSize = true;
this.labelStartRow.BackColor = System.Drawing.Color.Transparent;
this.labelStartRow.Location = new System.Drawing.Point(6, 26);
this.labelStartRow.Name = "labelStartRow";
this.labelStartRow.Size = new System.Drawing.Size(52, 13);
this.labelStartRow.TabIndex = 16;
this.labelStartRow.Text = "Start row:";
//
// inputStartRow
//
this.inputStartRow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.inputStartRow.Location = new System.Drawing.Point(96, 24);
this.inputStartRow.Name = "inputStartRow";
this.inputStartRow.Size = new System.Drawing.Size(56, 20);
this.inputStartRow.TabIndex = 15;
//
// groupBoxSeparators
//
this.groupBoxSeparators.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSeparators.BackColor = System.Drawing.Color.Transparent;
this.groupBoxSeparators.Controls.Add(this.labelSepChars);
this.groupBoxSeparators.Controls.Add(this.checkSepComma);
this.groupBoxSeparators.Controls.Add(this.checkSepSemicolon);
this.groupBoxSeparators.Controls.Add(this.checkSepTab);
this.groupBoxSeparators.Controls.Add(this.checkSepSpace);
this.groupBoxSeparators.Controls.Add(this.checkCombine);
this.groupBoxSeparators.Controls.Add(this.checkSepOthers);
this.groupBoxSeparators.Controls.Add(this.inputSepOthers);
this.groupBoxSeparators.Location = new System.Drawing.Point(344, 206);
this.groupBoxSeparators.Name = "groupBoxSeparators";
this.groupBoxSeparators.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupBoxSeparators.Size = new System.Drawing.Size(158, 187);
this.groupBoxSeparators.TabIndex = 28;
this.groupBoxSeparators.TabStop = false;
this.groupBoxSeparators.Text = "Separator characters";
//
// ImportCsvWindow
//
this.AcceptButton = this.buttonAccept;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(513, 436);
this.Controls.Add(this.groupBoxSeparators);
this.Controls.Add(this.groupBoxRange);
this.Controls.Add(this.groupBoxMatrixName);
this.Controls.Add(this.groupBoxSelectRange);
this.Controls.Add(this.label1);
this.Controls.Add(this.buttonEntire);
this.Controls.Add(this.buttonAccept);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "ImportCsvWindow";
this.Text = "Import from CSV file...";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ImportCsvWindow_FormClosing);
this.groupBoxSelectRange.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
this.groupBoxMatrixName.ResumeLayout(false);
this.groupBoxMatrixName.PerformLayout();
this.groupBoxRange.ResumeLayout(false);
this.groupBoxRange.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.inputEndColumn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.inputEndRow)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.inputStartColumn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.inputStartRow)).EndInit();
this.groupBoxSeparators.ResumeLayout(false);
this.groupBoxSeparators.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DynamicLink.Controls.MyButton buttonAccept;
private DynamicLink.Controls.MyButton buttonCancel;
private DynamicLink.Controls.MyButton buttonEntire;
private System.Windows.Forms.Label labelSepChars;
private System.Windows.Forms.CheckBox checkSepComma;
private System.Windows.Forms.CheckBox checkSepSemicolon;
private System.Windows.Forms.CheckBox checkSepTab;
private System.Windows.Forms.CheckBox checkSepSpace;
private System.Windows.Forms.CheckBox checkSepOthers;
private System.Windows.Forms.TextBox inputSepOthers;
private System.Windows.Forms.CheckBox checkCombine;
private System.Windows.Forms.Label label1;
private DynamicLink.Controls.MyGroupBox groupBoxSelectRange;
public System.Windows.Forms.DataGridView dataGrid;
private DynamicLink.Controls.MyGroupBox groupBoxMatrixName;
private System.Windows.Forms.TextBox inputName;
private DynamicLink.Controls.MyGroupBox groupBoxRange;
private System.Windows.Forms.Label labelEndColumn;
private System.Windows.Forms.NumericUpDown inputEndColumn;
private System.Windows.Forms.Label labelEndRow;
private System.Windows.Forms.NumericUpDown inputEndRow;
private System.Windows.Forms.Label labelStartColumn;
private System.Windows.Forms.NumericUpDown inputStartColumn;
private System.Windows.Forms.Label labelStartRow;
private System.Windows.Forms.NumericUpDown inputStartRow;
private DynamicLink.Controls.MyGroupBox groupBoxSeparators;
}
}

View File

@ -0,0 +1,225 @@
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 ImportCsvWindow : Form
{
private string csv;
private bool allowExit = true;
#region Public properties
public int StartRow { get; set; }
public int StartCol { get; set; }
public int EndRow { get; set; }
public int EndCol { get; set; }
public string Csv{
get { return csv; }
set { csv = value; UpdateGrid(); }
}
public string MatrixName {
get {
return inputName.Text;
}
set {
inputName.Text = value;
}
}
public MathNet.Numerics.LinearAlgebra.Matrix<double> Matrix
{
get { return GridViewHelper.GetMatrix(dataGrid); }
set { GridViewHelper.PutMatrix(value, dataGrid); }
}
#endregion
private Dictionary<char, bool> separators = new Dictionary<char,bool>();
public ImportCsvWindow()
{
InitializeComponent();
separators.Add(',', true);
separators.Add('\t', false);
separators.Add(' ', false);
separators.Add(';', false);
}
public void LoadFile(string filename)
{
if (System.IO.File.Exists(filename))
Csv = System.IO.File.ReadAllText(filename);
}
private void UpdateGrid()
{
List<char> sep = new List<char>();
foreach (var i in separators)
if (i.Value) sep.Add(i.Key);
// Update data
dataGrid.DataSource = CsvParser.GetTable(Csv, sep.ToArray(), checkCombine.Checked);
foreach (DataGridViewColumn i in dataGrid.Columns)
{
i.HeaderText = "";
i.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
}
// Update sizes
inputStartRow.Value = 0;
inputStartColumn.Value = 0;
inputEndColumn.Value = inputEndColumn.Maximum = dataGrid.Columns.Count - 1;
inputEndRow.Value = inputEndRow.Maximum = dataGrid.Rows.Count - 1;
}
#region Separators
private void checkCombine_CheckedChanged(object sender, EventArgs e)
{
UpdateGrid();
}
private void checkSepComma_CheckedChanged(object sender, EventArgs e)
{
separators[','] = checkSepComma.Checked;
UpdateGrid();
}
private void checkSepSemicolon_CheckedChanged(object sender, EventArgs e)
{
separators[';'] = checkSepComma.Checked;
UpdateGrid();
}
private void checkSepSpace_CheckedChanged(object sender, EventArgs e)
{
separators[' '] = checkSepComma.Checked;
UpdateGrid();
}
private void checkSepOthers_CheckedChanged(object sender, EventArgs e)
{
List<char> temp = new List<char>();
foreach (var i in separators)
if (i.Key != ' ' && i.Key != '\t' && i.Key != ';' && i.Key != ',')
temp.Add(i.Key);
foreach (var i in temp) separators[i] = false;
if (checkSepOthers.Checked)
foreach (var i in inputSepOthers.Text)
separators[i] = true;
UpdateGrid();
}
private void checkSepTab_CheckedChanged(object sender, EventArgs e)
{
separators['\t'] = checkSepComma.Checked;
UpdateGrid();
}
private void inputSepOthers_TextChanged(object sender, EventArgs e)
{
List<char> temp = new List<char>();
foreach (var i in separators)
if (i.Key != ' ' && i.Key != '\t' && i.Key != ';' && i.Key != ',')
temp.Add(i.Key);
foreach (var i in temp) separators[i] = false;
if (checkSepOthers.Checked)
foreach (var i in inputSepOthers.Text)
separators[i] = true;
UpdateGrid();
}
#endregion
#region Form buttons
private void buttonEntire_Click(object sender, EventArgs e)
{
StartCol = StartRow = 0;
inputEndColumn.Value = dataGrid.Columns.Count - 1;
inputEndRow.Value = dataGrid.Rows.Count - 1;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void buttonAccept_Click(object sender, EventArgs e)
{
// Get numbers
StartCol = Convert.ToInt32(inputStartColumn.Value);
StartRow = Convert.ToInt32(inputStartRow.Value);
EndCol = Convert.ToInt32(inputEndColumn.Value);
EndRow = Convert.ToInt32(inputEndRow.Value);
// Validate input
if (inputName.Text == "")
{
allowExit = false;
MessageBox.Show("Name cannot be empty!", "Error!");
return;
}
if (EndCol - StartCol <= 0 || EndRow - StartRow <= 0)
{
allowExit = false;
MessageBox.Show("Invalid range, the matrix must have at least one row and one column.", "Error!");
return;
}
// Trim unneeded rows and columns
while (StartCol > 0) {
dataGrid.Columns.RemoveAt(0);
StartCol--;
EndCol--;
}
while (StartRow > 0) {
dataGrid.Rows.RemoveAt(0);
StartRow--;
EndRow--;
}
GridViewHelper.Resize(dataGrid, EndCol + 1, EndRow + 1);
// Done, finish
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
#endregion
private void ImportCsvWindow_FormClosing(object sender, FormClosingEventArgs e)
{
if (!allowExit)
{
allowExit = true;
e.Cancel = true;
}
}
#region Painting
protected override void OnPaintBackground(PaintEventArgs e)
{
DynamicLink.Controls.BackgroundGradient.Paint(e.Graphics, new Rectangle(-1, -1, this.Width, this.Height));
}
#endregion
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,113 @@
namespace MatrixCalculator
{
partial class ImportWorksheetWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listMatrices = new System.Windows.Forms.CheckedListBox();
this.buttonAccept = new DynamicLink.Controls.MyButton();
this.buttonCancel = new DynamicLink.Controls.MyButton();
this.groupBoxSelectMatrices = new DynamicLink.Controls.MyGroupBox();
this.groupBoxSelectMatrices.SuspendLayout();
this.SuspendLayout();
//
// listMatrices
//
this.listMatrices.CheckOnClick = true;
this.listMatrices.Dock = System.Windows.Forms.DockStyle.Fill;
this.listMatrices.FormattingEnabled = true;
this.listMatrices.Location = new System.Drawing.Point(5, 23);
this.listMatrices.Name = "listMatrices";
this.listMatrices.Size = new System.Drawing.Size(250, 215);
this.listMatrices.TabIndex = 0;
//
// buttonAccept
//
this.buttonAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAccept.BackColor = System.Drawing.Color.Transparent;
this.buttonAccept.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonAccept.ForeColor = System.Drawing.Color.DarkGreen;
this.buttonAccept.Location = new System.Drawing.Point(197, 261);
this.buttonAccept.Name = "buttonAccept";
this.buttonAccept.Size = new System.Drawing.Size(75, 23);
this.buttonAccept.TabIndex = 5;
this.buttonAccept.Text = "Accept";
this.buttonAccept.UseVisualStyleBackColor = false;
this.buttonAccept.Click += new System.EventHandler(this.buttonAccept_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.BackColor = System.Drawing.Color.Transparent;
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(116, 261);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 4;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = false;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// groupBoxSelectMatrices
//
this.groupBoxSelectMatrices.BackColor = System.Drawing.Color.Transparent;
this.groupBoxSelectMatrices.Controls.Add(this.listMatrices);
this.groupBoxSelectMatrices.Location = new System.Drawing.Point(12, 12);
this.groupBoxSelectMatrices.Name = "groupBoxSelectMatrices";
this.groupBoxSelectMatrices.Padding = new System.Windows.Forms.Padding(5, 10, 5, 5);
this.groupBoxSelectMatrices.Size = new System.Drawing.Size(260, 243);
this.groupBoxSelectMatrices.TabIndex = 6;
this.groupBoxSelectMatrices.TabStop = false;
this.groupBoxSelectMatrices.Text = "Select matrices to import:";
//
// ImportWorksheetWindow
//
this.AcceptButton = this.buttonAccept;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(284, 296);
this.Controls.Add(this.groupBoxSelectMatrices);
this.Controls.Add(this.buttonAccept);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "ImportWorksheetWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Import from worksheet...";
this.groupBoxSelectMatrices.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.CheckedListBox listMatrices;
private DynamicLink.Controls.MyButton buttonAccept;
private DynamicLink.Controls.MyButton buttonCancel;
private DynamicLink.Controls.MyGroupBox groupBoxSelectMatrices;
}
}

View File

@ -0,0 +1,59 @@
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 ImportWorksheetWindow : Form
{
public DataTable Data { get; set; }
public ImportWorksheetWindow()
{
InitializeComponent();
}
public void LoadFile(string filename)
{
WorksheetFile file = new WorksheetFile(filename);
Data = file.Read();
listMatrices.Items.Clear();
foreach (DataRow i in Data.Rows)
listMatrices.Items.Add(i["name"].ToString());
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
private void buttonAccept_Click(object sender, EventArgs e)
{
List<DataRow> toRemove = new List<DataRow>();
foreach (DataRow i in Data.Rows)
if (!listMatrices.CheckedItems.Contains(i["name"].ToString())) toRemove.Add(i);
foreach (var i in toRemove)
Data.Rows.Remove(i);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
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
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,131 @@
namespace MatrixCalculator
{
partial class NumericInput
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.inputBox = new System.Windows.Forms.TextBox();
this.buttonCancel = new DynamicLink.Controls.MyButton();
this.buttonAccept = new DynamicLink.Controls.MyButton();
this.labelMessage = new System.Windows.Forms.Label();
this.myGroupBox = new DynamicLink.Controls.MyGroupBox();
this.myGroupBox.SuspendLayout();
this.SuspendLayout();
//
// inputBox
//
this.inputBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.inputBox.Location = new System.Drawing.Point(6, 26);
this.inputBox.Name = "inputBox";
this.inputBox.Size = new System.Drawing.Size(256, 20);
this.inputBox.TabIndex = 1;
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.BackColor = System.Drawing.Color.Transparent;
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(112, 71);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 2;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = false;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// buttonAccept
//
this.buttonAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAccept.BackColor = System.Drawing.Color.Transparent;
this.buttonAccept.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonAccept.ForeColor = System.Drawing.Color.DarkGreen;
this.buttonAccept.Location = new System.Drawing.Point(193, 71);
this.buttonAccept.Name = "buttonAccept";
this.buttonAccept.Size = new System.Drawing.Size(75, 23);
this.buttonAccept.TabIndex = 3;
this.buttonAccept.Text = "Accept";
this.buttonAccept.UseVisualStyleBackColor = false;
this.buttonAccept.Click += new System.EventHandler(this.buttonAccept_Click);
//
// labelMessage
//
this.labelMessage.AutoSize = true;
this.labelMessage.BackColor = System.Drawing.Color.Transparent;
this.labelMessage.Location = new System.Drawing.Point(6, 6);
this.labelMessage.Name = "labelMessage";
this.labelMessage.Size = new System.Drawing.Size(92, 13);
this.labelMessage.TabIndex = 0;
this.labelMessage.Text = "Insert a ? number:";
//
// myGroupBox
//
this.myGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.myGroupBox.BackColor = System.Drawing.Color.Transparent;
this.myGroupBox.Controls.Add(this.labelMessage);
this.myGroupBox.Controls.Add(this.inputBox);
this.myGroupBox.Location = new System.Drawing.Point(6, 7);
this.myGroupBox.Name = "myGroupBox";
this.myGroupBox.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.myGroupBox.Size = new System.Drawing.Size(269, 58);
this.myGroupBox.TabIndex = 4;
this.myGroupBox.TabStop = false;
//
// NumericInput
//
this.AcceptButton = this.buttonAccept;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(280, 106);
this.Controls.Add(this.myGroupBox);
this.Controls.Add(this.buttonAccept);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NumericInput";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.NumericInput_FormClosing);
this.myGroupBox.ResumeLayout(false);
this.myGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TextBox inputBox;
private DynamicLink.Controls.MyButton buttonCancel;
private DynamicLink.Controls.MyButton buttonAccept;
private System.Windows.Forms.Label labelMessage;
private DynamicLink.Controls.MyGroupBox myGroupBox;
}
}

View File

@ -0,0 +1,109 @@
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 NumericInput : Form
{
public enum NumberType { Integer, Real };
#region Data
bool allowExit = true;
private NumberType type;
public NumberType Type {
get { return type; }
set
{
if (value == NumberType.Integer) labelMessage.Text = "Insert an integer number:";
else labelMessage.Text = "Insert a real number:";
type = value;
}
}
public double NumberReal
{
get {
double ret = 0;
double.TryParse(inputBox.Text, out ret);
return ret;
}
set {
inputBox.Text = value.ToString();
}
}
public int NumberInt
{
get {
int ret = 0;
int.TryParse(inputBox.Text, out ret);
return ret;
}
set {
inputBox.Text = value.ToString();
}
}
#endregion
public NumericInput(NumberType t = NumberType.Real)
{
InitializeComponent();
Type = t;
}
private void buttonAccept_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
// Validate input
bool ok = true;
double val;
int vali;
if (Type == NumberType.Real) ok = double.TryParse(inputBox.Text, out val);
else ok = int.TryParse(inputBox.Text, out vali);
// Is everything ok?
if (!ok)
{
allowExit = false;
inputBox.BackColor = Color.LightPink;
labelMessage.Font = new Font(labelMessage.Font, FontStyle.Bold);
}
}
private void buttonCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
private void NumericInput_FormClosing(object sender, FormClosingEventArgs e)
{
if (!allowExit)
{
allowExit = true;
e.Cancel = true;
}
}
#region Paint
protected override void OnPaintBackground(PaintEventArgs e)
{
DynamicLink.Controls.BackgroundGradient.Paint(e.Graphics, new Rectangle(-1, -1, this.Width, this.Height));
}
#endregion
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,169 @@
namespace MatrixCalculator
{
partial class SettingsWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.buttonAccept = new DynamicLink.Controls.MyButton();
this.buttonCancel = new DynamicLink.Controls.MyButton();
this.groupBox1 = new DynamicLink.Controls.MyGroupBox();
this.label1 = new System.Windows.Forms.Label();
this.checkResultAsMatrix = new System.Windows.Forms.CheckBox();
this.inputDoublePrecision = new System.Windows.Forms.NumericUpDown();
this.checkDoublePrecision = new System.Windows.Forms.CheckBox();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.inputDoublePrecision)).BeginInit();
this.SuspendLayout();
//
// buttonAccept
//
this.buttonAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonAccept.BackColor = System.Drawing.Color.Transparent;
this.buttonAccept.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonAccept.ForeColor = System.Drawing.Color.DarkGreen;
this.buttonAccept.Location = new System.Drawing.Point(223, 116);
this.buttonAccept.Name = "buttonAccept";
this.buttonAccept.Size = new System.Drawing.Size(75, 23);
this.buttonAccept.TabIndex = 7;
this.buttonAccept.Text = "Accept";
this.buttonAccept.UseVisualStyleBackColor = false;
this.buttonAccept.Click += new System.EventHandler(this.buttonAccept_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.BackColor = System.Drawing.Color.Transparent;
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(142, 116);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 6;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = false;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.BackColor = System.Drawing.Color.Transparent;
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.checkResultAsMatrix);
this.groupBox1.Controls.Add(this.inputDoublePrecision);
this.groupBox1.Controls.Add(this.checkDoublePrecision);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 8, 3, 3);
this.groupBox1.Size = new System.Drawing.Size(286, 98);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Matrix calculator preferences";
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(204, 33);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 15;
this.label1.Text = "decimal digits";
//
// checkResultAsMatrix
//
this.checkResultAsMatrix.AutoSize = true;
this.checkResultAsMatrix.BackColor = System.Drawing.Color.Transparent;
this.checkResultAsMatrix.Location = new System.Drawing.Point(16, 65);
this.checkResultAsMatrix.Name = "checkResultAsMatrix";
this.checkResultAsMatrix.Size = new System.Drawing.Size(154, 17);
this.checkResultAsMatrix.TabIndex = 14;
this.checkResultAsMatrix.Text = "Show result as a 1x1 matrix";
this.toolTip.SetToolTip(this.checkResultAsMatrix, "If set, the result of numeric calculations (like determinant, minimum element etc" +
") will be displayed as a 1x1 matrix. Otherwise, it will be displayed in the \"Out" +
"put\" box.");
this.checkResultAsMatrix.UseVisualStyleBackColor = false;
//
// inputDoublePrecision
//
this.inputDoublePrecision.Location = new System.Drawing.Point(138, 31);
this.inputDoublePrecision.Name = "inputDoublePrecision";
this.inputDoublePrecision.Size = new System.Drawing.Size(60, 20);
this.inputDoublePrecision.TabIndex = 13;
this.toolTip.SetToolTip(this.inputDoublePrecision, "For example, if value is 1, number 0.234 will be displayed as 0.2 ");
//
// checkDoublePrecision
//
this.checkDoublePrecision.AutoSize = true;
this.checkDoublePrecision.BackColor = System.Drawing.Color.Transparent;
this.checkDoublePrecision.Location = new System.Drawing.Point(16, 32);
this.checkDoublePrecision.Name = "checkDoublePrecision";
this.checkDoublePrecision.Size = new System.Drawing.Size(116, 17);
this.checkDoublePrecision.TabIndex = 12;
this.checkDoublePrecision.Text = "Round numbers to:";
this.toolTip.SetToolTip(this.checkDoublePrecision, "If set, the number of decimals will be limited to the number selected.");
this.checkDoublePrecision.UseVisualStyleBackColor = false;
this.checkDoublePrecision.CheckedChanged += new System.EventHandler(this.checkDoublePrecision_CheckedChanged);
//
// SettingsWindow
//
this.AcceptButton = this.buttonAccept;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(310, 151);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.buttonAccept);
this.Controls.Add(this.buttonCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsWindow";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Preferences";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.inputDoublePrecision)).EndInit();
this.ResumeLayout(false);
}
#endregion
private DynamicLink.Controls.MyButton buttonAccept;
private DynamicLink.Controls.MyButton buttonCancel;
private DynamicLink.Controls.MyGroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox checkResultAsMatrix;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.NumericUpDown inputDoublePrecision;
private System.Windows.Forms.CheckBox checkDoublePrecision;
}
}

View File

@ -0,0 +1,60 @@
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
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>