Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace TestWindow1
- {
- public partial class Form1 : Form
- {
- private TextBox textBox1;
- private TextBox textBox2;
- private Button button1;
- private Label label1;
- private TextBox textBox3;
- private Label label2;
- private readonly object hScrollBar1;
- string[] Command = { "^p^", "cls" };
- public Form1()
- {
- InitializeComponent();
- }
- private void InitializeComponent()
- {
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.button1 = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.textBox3 = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // textBox1
- //
- this.textBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.textBox1.ForeColor = System.Drawing.Color.AliceBlue;
- this.textBox1.Location = new System.Drawing.Point(2, 123);
- this.textBox1.Multiline = true;
- this.textBox1.Name = "textBox1";
- this.textBox1.ReadOnly = true;
- this.textBox1.Size = new System.Drawing.Size(625, 552);
- this.textBox1.TabIndex = 0;
- this.textBox1.Text = ">";
- this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox2
- //
- this.textBox2.BackColor = System.Drawing.SystemColors.WindowFrame;
- this.textBox2.ForeColor = System.Drawing.Color.AliceBlue;
- this.textBox2.Location = new System.Drawing.Point(2, 86);
- this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(542, 19);
- this.textBox2.TabIndex = 1;
- this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
- //
- // button1
- //
- this.button1.BackColor = System.Drawing.SystemColors.ControlLight;
- this.button1.Location = new System.Drawing.Point(550, 86);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(71, 19);
- this.button1.TabIndex = 2;
- this.button1.Text = "Run";
- this.button1.UseVisualStyleBackColor = false;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.BackColor = System.Drawing.SystemColors.Control;
- this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.label1.Location = new System.Drawing.Point(0, 108);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(46, 12);
- this.label1.TabIndex = 4;
- this.label1.Text = "Console";
- //
- // textBox3
- //
- this.textBox3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.textBox3.ForeColor = System.Drawing.Color.AliceBlue;
- this.textBox3.Location = new System.Drawing.Point(647, 339);
- this.textBox3.Multiline = true;
- this.textBox3.Name = "textBox3";
- this.textBox3.ReadOnly = true;
- this.textBox3.Size = new System.Drawing.Size(217, 336);
- this.textBox3.TabIndex = 5;
- this.textBox3.Text = ">";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(645, 324);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(166, 12);
- this.label2.TabIndex = 6;
- this.label2.Text = "宣言された型(まだ実装してません)";
- //
- // Form1
- //
- this.AutoSize = true;
- this.ClientSize = new System.Drawing.Size(1487, 687);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.textBox3);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.textBox2);
- this.Controls.Add(this.textBox1);
- this.Name = "Form1";
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string s;
- s = ">";
- commandline();
- textBox1.AppendText(s);
- }
- public new string Text
- {
- get
- {
- return textBox2.Text;
- }
- set
- {
- value = textBox2.Text;
- }
- }
- public void put(String str)
- {
- textBox1.AppendText(str);
- }
- public void commandline()
- {
- if (Text == cm(0))
- {
- put("^p^<コポォ\n");
- }
- else if (Text == cm(1))
- {
- textBox1.Clear();
- put("[Console]クリアしました。\n");
- }
- else if (Text == "help")
- {
- put("---help\n");
- for (int i = 0; i < Command.Length; i++)
- {
- put(Command[i] + "\n");
- }
- put("-------\n");
- }
- else
- {
- if (Text == "")
- {
- put(
- "error : コマンドが入力されていません。\n");
- }
- else
- {
- put(
- "error : '" + Text + "'" + "は、\n"
- + "実行可能なファイル又は、\n"
- + "コマンドとして認識、定義されていません。\n");
- }
- }
- }
- public String cm(int e)
- {
- return Command[e];
- }
- }
- //function
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement