diff --git a/CutToLength/Class1.cs b/CutToLength/Class1.cs
new file mode 100644
index 0000000..e62235d
--- /dev/null
+++ b/CutToLength/Class1.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CutToLength
+{
+ class Class1 : Control
+ {
+ public Bin Bin { get; set; }
+
+ private const int BorderPixels = 15;
+ private const int BinHeightPixels = 100;
+
+ public Class1()
+ {
+ SetStyle(ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+
+ var displayWidth = Width - BorderPixels * 2.0f;
+ var maxHeight = Height - BorderPixels * 2.0f;
+
+ if (displayWidth <= 0) return;
+ if (maxHeight <= 0) return;
+
+ var displayHeight = maxHeight < BinHeightPixels ? maxHeight : BinHeightPixels;
+
+ var x = (Width - displayWidth) / 2.0f;
+ var y = (Height - displayHeight) / 2.0f;
+
+ var rect = new RectangleF(x, y, displayWidth, displayHeight);
+
+ var drawX = (float)x;
+ var id = 1;
+ var scale = displayWidth / Bin.Length;
+ var totalLength = 0.0;
+
+ if (Bin != null)
+ {
+ foreach (var item in Bin.Items)
+ {
+ var xc = item.Length
+ var w = item.Length / Bin.Length * displayWidth;
+ var r = new RectangleF(drawX, y, (float)w, displayHeight);
+
+ e.Graphics.DrawRectangle(Pens.Blue, r.X, r.Y, r.Width, r.Height);
+ e.Graphics.DrawString(id++.ToString(), Font, Brushes.Blue, r, new StringFormat
+ {
+ Alignment = StringAlignment.Center,
+ LineAlignment = StringAlignment.Center
+ });
+
+ drawX = r.Right;
+ }
+ }
+
+ var scrapRect = new RectangleF(drawX, y, rect.Right - drawX, displayHeight);
+
+ e.Graphics.FillRectangle(Brushes.Red, scrapRect);
+ e.Graphics.DrawRectangle(Pens.Black, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+ }
+}
diff --git a/CutToLength/CutToLength.csproj b/CutToLength/CutToLength.csproj
index 76fa617..c13c9db 100644
--- a/CutToLength/CutToLength.csproj
+++ b/CutToLength/CutToLength.csproj
@@ -50,17 +50,29 @@
+
+ Component
+
Form
Form1.cs
+
+ Form
+
+
+ Form2.cs
+
Form1.cs
+
+ Form2.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
@@ -72,7 +84,10 @@
True
+
+
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/CutToLength/Form1.cs b/CutToLength/Form1.cs
index 075b214..381491c 100644
--- a/CutToLength/Form1.cs
+++ b/CutToLength/Form1.cs
@@ -56,13 +56,17 @@ namespace CutToLength
{
var bins = GetResults();
- var saveFileDialog = new SaveFileDialog();
- saveFileDialog.Filter = "Text File|*.txt";
+ var form = new Form2();
+ form.Bins = bins;
+ form.ShowDialog();
- if (saveFileDialog.ShowDialog() == DialogResult.OK)
- {
- SaveBins(saveFileDialog.FileName, bins);
- }
+ //var saveFileDialog = new SaveFileDialog();
+ //saveFileDialog.Filter = "Text File|*.txt";
+
+ //if (saveFileDialog.ShowDialog() == DialogResult.OK)
+ //{
+ // SaveBins(saveFileDialog.FileName, bins);
+ //}
}
private List GetResults()
diff --git a/CutToLength/Form2.Designer.cs b/CutToLength/Form2.Designer.cs
new file mode 100644
index 0000000..db7e805
--- /dev/null
+++ b/CutToLength/Form2.Designer.cs
@@ -0,0 +1,173 @@
+namespace CutToLength
+{
+ partial class Form2
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.dataGridView1 = new System.Windows.Forms.DataGridView();
+ this.spacingDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.usedLengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.remainingLengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.utilizationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.binBindingSource = new System.Windows.Forms.BindingSource(this.components);
+ this.class11 = new CutToLength.Class1();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.uIItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.binBindingSource)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.uIItemBindingSource)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView1
+ //
+ this.dataGridView1.AutoGenerateColumns = false;
+ this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.spacingDataGridViewTextBoxColumn,
+ this.lengthDataGridViewTextBoxColumn,
+ this.usedLengthDataGridViewTextBoxColumn,
+ this.remainingLengthDataGridViewTextBoxColumn,
+ this.utilizationDataGridViewTextBoxColumn});
+ this.dataGridView1.DataSource = this.binBindingSource;
+ this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView1.Location = new System.Drawing.Point(0, 0);
+ this.dataGridView1.Name = "dataGridView1";
+ this.dataGridView1.Size = new System.Drawing.Size(892, 256);
+ this.dataGridView1.TabIndex = 0;
+ this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter);
+ this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
+ //
+ // spacingDataGridViewTextBoxColumn
+ //
+ this.spacingDataGridViewTextBoxColumn.DataPropertyName = "Spacing";
+ this.spacingDataGridViewTextBoxColumn.HeaderText = "Spacing";
+ this.spacingDataGridViewTextBoxColumn.Name = "spacingDataGridViewTextBoxColumn";
+ //
+ // lengthDataGridViewTextBoxColumn
+ //
+ this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length";
+ this.lengthDataGridViewTextBoxColumn.HeaderText = "Length";
+ this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn";
+ //
+ // usedLengthDataGridViewTextBoxColumn
+ //
+ this.usedLengthDataGridViewTextBoxColumn.DataPropertyName = "UsedLength";
+ this.usedLengthDataGridViewTextBoxColumn.HeaderText = "UsedLength";
+ this.usedLengthDataGridViewTextBoxColumn.Name = "usedLengthDataGridViewTextBoxColumn";
+ this.usedLengthDataGridViewTextBoxColumn.ReadOnly = true;
+ //
+ // remainingLengthDataGridViewTextBoxColumn
+ //
+ this.remainingLengthDataGridViewTextBoxColumn.DataPropertyName = "RemainingLength";
+ this.remainingLengthDataGridViewTextBoxColumn.HeaderText = "RemainingLength";
+ this.remainingLengthDataGridViewTextBoxColumn.Name = "remainingLengthDataGridViewTextBoxColumn";
+ this.remainingLengthDataGridViewTextBoxColumn.ReadOnly = true;
+ //
+ // utilizationDataGridViewTextBoxColumn
+ //
+ this.utilizationDataGridViewTextBoxColumn.DataPropertyName = "Utilization";
+ this.utilizationDataGridViewTextBoxColumn.HeaderText = "Utilization";
+ this.utilizationDataGridViewTextBoxColumn.Name = "utilizationDataGridViewTextBoxColumn";
+ this.utilizationDataGridViewTextBoxColumn.ReadOnly = true;
+ //
+ // binBindingSource
+ //
+ this.binBindingSource.DataSource = typeof(CutToLength.Bin);
+ //
+ // class11
+ //
+ this.class11.BackColor = System.Drawing.Color.White;
+ this.class11.Bin = null;
+ this.class11.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.class11.Location = new System.Drawing.Point(0, 0);
+ this.class11.Name = "class11";
+ this.class11.Size = new System.Drawing.Size(892, 181);
+ this.class11.TabIndex = 1;
+ this.class11.Text = "class11";
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.dataGridView1);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.class11);
+ this.splitContainer1.Size = new System.Drawing.Size(892, 441);
+ this.splitContainer1.SplitterDistance = 256;
+ this.splitContainer1.TabIndex = 2;
+ //
+ // uIItemBindingSource
+ //
+ this.uIItemBindingSource.DataSource = typeof(CutToLength.UIItem);
+ //
+ // Form2
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(892, 441);
+ this.Controls.Add(this.splitContainer1);
+ this.Name = "Form2";
+ this.Text = "Form2";
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.binBindingSource)).EndInit();
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.uIItemBindingSource)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DataGridView dataGridView1;
+ private Class1 class11;
+ private System.Windows.Forms.DataGridViewTextBoxColumn spacingDataGridViewTextBoxColumn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn lengthDataGridViewTextBoxColumn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn usedLengthDataGridViewTextBoxColumn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn remainingLengthDataGridViewTextBoxColumn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn utilizationDataGridViewTextBoxColumn;
+ private System.Windows.Forms.BindingSource binBindingSource;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.BindingSource uIItemBindingSource;
+ }
+}
\ No newline at end of file
diff --git a/CutToLength/Form2.cs b/CutToLength/Form2.cs
new file mode 100644
index 0000000..842dae6
--- /dev/null
+++ b/CutToLength/Form2.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CutToLength
+{
+ public partial class Form2 : Form
+ {
+ public Form2()
+ {
+ InitializeComponent();
+ }
+
+ private void dataGridView1_SelectionChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
+ {
+ var selectedBin = dataGridView1.Rows[e.RowIndex].DataBoundItem as Bin;
+
+ if (selectedBin == null)
+ return;
+
+ class11.Bin = selectedBin;
+ class11.Invalidate();
+ }
+
+ public List Bins
+ {
+ get { return dataGridView1.DataSource as List; }
+ set { dataGridView1.DataSource = value; }
+ }
+ }
+}
diff --git a/CutToLength/Form2.resx b/CutToLength/Form2.resx
new file mode 100644
index 0000000..ec67bcb
--- /dev/null
+++ b/CutToLength/Form2.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+ 165, 17
+
+
\ No newline at end of file
diff --git a/CutToLength/Properties/DataSources/Bin.datasource b/CutToLength/Properties/DataSources/Bin.datasource
new file mode 100644
index 0000000..d467e17
--- /dev/null
+++ b/CutToLength/Properties/DataSources/Bin.datasource
@@ -0,0 +1,10 @@
+
+
+
+ CutToLength.Bin, CutToLength, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/CutToLength/Properties/DataSources/BinItem.datasource b/CutToLength/Properties/DataSources/BinItem.datasource
new file mode 100644
index 0000000..ba4d287
--- /dev/null
+++ b/CutToLength/Properties/DataSources/BinItem.datasource
@@ -0,0 +1,10 @@
+
+
+
+ CutToLength.BinItem, CutToLength, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/CutToLength/Properties/DataSources/UIItem.datasource b/CutToLength/Properties/DataSources/UIItem.datasource
new file mode 100644
index 0000000..9bab129
--- /dev/null
+++ b/CutToLength/Properties/DataSources/UIItem.datasource
@@ -0,0 +1,10 @@
+
+
+
+ CutToLength.UIItem, CutToLength, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file