Commit c8796eef authored by Tim Falken's avatar Tim Falken
Browse files

implement ReadByte

parent 83e228c2
No preview for this file type
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ColorPicker));
this.PaintRedBtn = new System.Windows.Forms.Button();
this.PaintGreenBtn = new System.Windows.Forms.Button();
this.PaintBlueBtn = new System.Windows.Forms.Button();
......@@ -249,6 +250,7 @@
this.Controls.Add(this.PaintGreenBtn);
this.Controls.Add(this.PaintRedBtn);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "ColorPicker";
this.Text = "ColorPicker";
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -453,6 +453,15 @@ namespace PaintLang
return;
}
if (color == colorPicker.Read)
{
InputByte input = new InputByte();
input.ShowDialog();
memoryDisplayer.SetMemory(input.UserInput);
return;
}
if (color == colorPicker.TurnR)
{
bool memoryZero = memoryDisplayer.CurrentMemoryValue == 0x00;
......
namespace PaintLang
{
partial class InputByte
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputByte));
this.inputDec = new System.Windows.Forms.NumericUpDown();
this.hexBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.okBtn = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.inputDec)).BeginInit();
this.SuspendLayout();
//
// inputDec
//
this.inputDec.Location = new System.Drawing.Point(52, 12);
this.inputDec.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.inputDec.Name = "inputDec";
this.inputDec.Size = new System.Drawing.Size(120, 20);
this.inputDec.TabIndex = 0;
this.inputDec.ValueChanged += new System.EventHandler(this.inputDec_ValueChanged);
//
// hexBox
//
this.hexBox.Font = new System.Drawing.Font("Lucida Console", 8.25F);
this.hexBox.Location = new System.Drawing.Point(52, 39);
this.hexBox.Name = "hexBox";
this.hexBox.ReadOnly = true;
this.hexBox.Size = new System.Drawing.Size(120, 18);
this.hexBox.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(34, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Input:";
//
// okBtn
//
this.okBtn.Location = new System.Drawing.Point(97, 65);
this.okBtn.Name = "okBtn";
this.okBtn.Size = new System.Drawing.Size(75, 23);
this.okBtn.TabIndex = 3;
this.okBtn.Text = "OK";
this.okBtn.UseVisualStyleBackColor = true;
this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
//
// InputByte
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(185, 97);
this.Controls.Add(this.okBtn);
this.Controls.Add(this.label1);
this.Controls.Add(this.hexBox);
this.Controls.Add(this.inputDec);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "InputByte";
this.Text = "Input Byte";
((System.ComponentModel.ISupportInitialize)(this.inputDec)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.NumericUpDown inputDec;
private System.Windows.Forms.TextBox hexBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button okBtn;
}
}
\ No newline at end of file
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 PaintLang
{
public partial class InputByte : Form
{
private Form1 main;
public byte UserInput = 0x00;
public InputByte()
{
InitializeComponent();
}
public void SetOwner(Form1 owner)
{
main = owner;
}
private void okBtn_Click(object sender, EventArgs e)
{
Close();
}
private void inputDec_ValueChanged(object sender, EventArgs e)
{
UserInput = (byte)inputDec.Value;
hexBox.Text = "0x" + UserInput.ToString("X2");
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MemoryDisplayer));
this.Pointerbox = new System.Windows.Forms.TextBox();
this.Memorybox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
......@@ -68,9 +69,10 @@
this.Controls.Add(this.Memorybox);
this.Controls.Add(this.Pointerbox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(133, 900000);
this.MinimumSize = new System.Drawing.Size(133, 32);
this.MinimumSize = new System.Drawing.Size(133, 39);
this.Name = "MemoryDisplayer";
this.Text = "MemoryDisplayer";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MemoryDisplayer_FormClosing);
......
......@@ -129,5 +129,10 @@ namespace PaintLang
{
e.Cancel = true;
}
internal void SetMemory(byte userInput)
{
memory[pointer] = userInput;
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewSizePicker));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
......@@ -154,6 +155,7 @@
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "NewSizePicker";
this.Text = "Resize";
((System.ComponentModel.ISupportInitialize)(this.widthBox)).EndInit();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -79,6 +79,12 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="InputByte.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InputByte.Designer.cs">
<DependentUpon>InputByte.cs</DependentUpon>
</Compile>
<Compile Include="MemoryDisplayer.cs">
<SubType>Form</SubType>
</Compile>
......@@ -105,6 +111,9 @@
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="InputByte.resx">
<DependentUpon>InputByte.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MemoryDisplayer.resx">
<DependentUpon>MemoryDisplayer.cs</DependentUpon>
</EmbeddedResource>
......
4536aa17267733b8ccaa93d8529298d411102da7
afefc61b9e8f8b19eed1f4e830871ec843ef1348
......@@ -25,3 +25,4 @@ D:\CsharpProjects\paintlang\PaintLang\bin\Debug\BytePaint.exe
D:\CsharpProjects\paintlang\PaintLang\bin\Debug\BytePaint.pdb
D:\CsharpProjects\paintlang\PaintLang\obj\Debug\BytePaint.exe
D:\CsharpProjects\paintlang\PaintLang\obj\Debug\BytePaint.pdb
D:\CsharpProjects\paintlang\PaintLang\obj\Debug\PaintLang.InputByte.resources
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment