Advertisement
8877omega_java

^p^

Oct 13th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.77 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12.  
  13. namespace TestWindow1
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         private TextBox textBox1;
  18.         private TextBox textBox2;
  19.         private Button button1;
  20.         private Label label1;
  21.         private TextBox textBox3;
  22.         private Label label2;
  23.         private readonly object hScrollBar1;
  24.         string[] Command = { "^p^", "cls" };
  25.  
  26.         public Form1()
  27.         {
  28.             InitializeComponent();
  29.         }
  30.         private void InitializeComponent()
  31.         {
  32.             this.textBox1 = new System.Windows.Forms.TextBox();
  33.             this.textBox2 = new System.Windows.Forms.TextBox();
  34.             this.button1 = new System.Windows.Forms.Button();
  35.             this.label1 = new System.Windows.Forms.Label();
  36.             this.textBox3 = new System.Windows.Forms.TextBox();
  37.             this.label2 = new System.Windows.Forms.Label();
  38.             this.SuspendLayout();
  39.             //
  40.             // textBox1
  41.             //
  42.             this.textBox1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  43.             this.textBox1.ForeColor = System.Drawing.Color.AliceBlue;
  44.             this.textBox1.Location = new System.Drawing.Point(2, 123);
  45.             this.textBox1.Multiline = true;
  46.             this.textBox1.Name = "textBox1";
  47.             this.textBox1.ReadOnly = true;
  48.             this.textBox1.Size = new System.Drawing.Size(625, 552);
  49.             this.textBox1.TabIndex = 0;
  50.             this.textBox1.Text = ">";
  51.             this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
  52.             //
  53.             // textBox2
  54.             //
  55.             this.textBox2.BackColor = System.Drawing.SystemColors.WindowFrame;
  56.             this.textBox2.ForeColor = System.Drawing.Color.AliceBlue;
  57.             this.textBox2.Location = new System.Drawing.Point(2, 86);
  58.             this.textBox2.Name = "textBox2";
  59.             this.textBox2.Size = new System.Drawing.Size(542, 19);
  60.             this.textBox2.TabIndex = 1;
  61.             this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
  62.             //
  63.             // button1
  64.             //
  65.             this.button1.BackColor = System.Drawing.SystemColors.ControlLight;
  66.             this.button1.Location = new System.Drawing.Point(550, 86);
  67.             this.button1.Name = "button1";
  68.             this.button1.Size = new System.Drawing.Size(71, 19);
  69.             this.button1.TabIndex = 2;
  70.             this.button1.Text = "Run";
  71.             this.button1.UseVisualStyleBackColor = false;
  72.             this.button1.Click += new System.EventHandler(this.button1_Click);
  73.             //
  74.             // label1
  75.             //
  76.             this.label1.AutoSize = true;
  77.             this.label1.BackColor = System.Drawing.SystemColors.Control;
  78.             this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  79.             this.label1.Location = new System.Drawing.Point(0, 108);
  80.             this.label1.Name = "label1";
  81.             this.label1.Size = new System.Drawing.Size(46, 12);
  82.             this.label1.TabIndex = 4;
  83.             this.label1.Text = "Console";
  84.             //
  85.             // textBox3
  86.             //
  87.             this.textBox3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
  88.             this.textBox3.ForeColor = System.Drawing.Color.AliceBlue;
  89.             this.textBox3.Location = new System.Drawing.Point(647, 339);
  90.             this.textBox3.Multiline = true;
  91.             this.textBox3.Name = "textBox3";
  92.             this.textBox3.ReadOnly = true;
  93.             this.textBox3.Size = new System.Drawing.Size(217, 336);
  94.             this.textBox3.TabIndex = 5;
  95.             this.textBox3.Text = ">";
  96.             //
  97.             // label2
  98.             //
  99.             this.label2.AutoSize = true;
  100.             this.label2.Location = new System.Drawing.Point(645, 324);
  101.             this.label2.Name = "label2";
  102.             this.label2.Size = new System.Drawing.Size(166, 12);
  103.             this.label2.TabIndex = 6;
  104.             this.label2.Text = "宣言された型(まだ実装してません)";
  105.             //
  106.             // Form1
  107.             //
  108.             this.AutoSize = true;
  109.             this.ClientSize = new System.Drawing.Size(1487, 687);
  110.             this.Controls.Add(this.label2);
  111.             this.Controls.Add(this.textBox3);
  112.             this.Controls.Add(this.label1);
  113.             this.Controls.Add(this.button1);
  114.             this.Controls.Add(this.textBox2);
  115.             this.Controls.Add(this.textBox1);
  116.             this.Name = "Form1";
  117.             this.ResumeLayout(false);
  118.             this.PerformLayout();
  119.  
  120.         }
  121.  
  122.         private void textBox1_TextChanged(object sender, EventArgs e)
  123.         {
  124.  
  125.         }
  126.  
  127.         private void textBox2_TextChanged(object sender, EventArgs e)
  128.         {
  129.  
  130.         }
  131.  
  132.         private void button1_Click(object sender, EventArgs e)
  133.         {
  134.             string s;
  135.             s = ">";
  136.             commandline();
  137.             textBox1.AppendText(s);
  138.         }
  139.         public new string Text
  140.         {
  141.             get
  142.             {
  143.                 return textBox2.Text;
  144.             }
  145.  
  146.             set
  147.             {
  148.                 value = textBox2.Text;
  149.             }
  150.         }
  151.         public void put(String str)
  152.         {
  153.             textBox1.AppendText(str);
  154.         }
  155.         public void commandline()
  156.         {
  157.             if (Text == cm(0))
  158.             {
  159.                 put("^p^<コポォ\n");
  160.             }
  161.             else if (Text == cm(1))
  162.             {
  163.                 textBox1.Clear();
  164.                 put("[Console]クリアしました。\n");
  165.             }
  166.             else if (Text == "help")
  167.             {
  168.                 put("---help\n");
  169.                 for (int i = 0; i < Command.Length; i++)
  170.                 {
  171.                     put(Command[i] + "\n");
  172.                 }
  173.                 put("-------\n");
  174.             }
  175.             else
  176.             {
  177.                 if (Text == "")
  178.                 {
  179.                     put(
  180.                     "error : コマンドが入力されていません。\n");
  181.                 }
  182.                 else
  183.                 {
  184.                     put(
  185.                     "error : '" + Text + "'" + "は、\n"
  186.                     + "実行可能なファイル又は、\n"
  187.                     + "コマンドとして認識、定義されていません。\n");
  188.                 }
  189.             }
  190.          }
  191.         public String cm(int e)
  192.         {
  193.             return Command[e];
  194.         }
  195.     }
  196.         //function
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement