Unicode encoding: implified Chinese


   


   using System;
   using System.Drawing;
   using System.Collections;
   using System.ComponentModel;
   using System.Windows.Forms;
   using System.Data;

   public class Unicode : System.Windows.Forms.Form {
      System.Windows.Forms.Label  myLabel = new System.Windows.Forms.Label();

      public Unicode()
      {
         this.SuspendLayout();

         this.myLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 50.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.myLabel.Location = new System.Drawing.Point(20, 20);
         this.myLabel.Size = new System.Drawing.Size(800, 800);

         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(800, 200);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {this.myLabel});
         this.Name = "Unicode";
         this.Text = "Unicode";
         this.Load += new System.EventHandler(this.Unicode_Load);
         this.ResumeLayout(false);
      }

      [STAThread]
      static void Main() 
      {
         Application.Run(new Unicode());
      }

      private void Unicode_Load(object sender, System.EventArgs e)
      {
         // Simplified Chinese
         char[] chinese = {'u6B22', 'u8FCE', 'u4F7F', 
                             'u7528', 'u0020' };                   

         myLabel.Text = new string(chinese) + "Unicode" + 'u0021';
      }
   }

           
          


Convert value from Numeric Dropdown to Int


   

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
{

   private System.Windows.Forms.NumericUpDown yearUpDown;
   private System.Windows.Forms.Button calculateButton;
   public Form1() {
      InitializeComponent();
   }
   private void calculateButton_Click( object sender, EventArgs e )
   {
      Console.WriteLine(Convert.ToInt32( yearUpDown.Value ));
   } 
   private void InitializeComponent()
   {
      this.yearUpDown = new System.Windows.Forms.NumericUpDown();
      this.calculateButton = new System.Windows.Forms.Button();
      ((System.ComponentModel.ISupportInitialize)(this.yearUpDown)).BeginInit();
      this.SuspendLayout();

      this.yearUpDown.Location = new System.Drawing.Point(84, 97);
      this.yearUpDown.Maximum = new decimal(new int[] {
            10,
            0,
            0,
            0});
      this.yearUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
      this.yearUpDown.Name = "yearUpDown";
      this.yearUpDown.ReadOnly = true;
      this.yearUpDown.Size = new System.Drawing.Size(100, 20);
      this.yearUpDown.TabIndex = 5;
      this.yearUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
      this.yearUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            0});
      this.calculateButton.Location = new System.Drawing.Point(196, 16);
      this.calculateButton.Name = "calculateButton";
      this.calculateButton.Size = new System.Drawing.Size(75, 23);
      this.calculateButton.TabIndex = 8;
      this.calculateButton.Text = "Calculate";
      this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click);
      // 
      // interestCalculatorForm
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(289, 288);
      this.Controls.Add(this.calculateButton);
      this.Controls.Add(this.yearUpDown);
      this.Name = "interestCalculatorForm";
      this.Text = "Interest Calculator";
      ((System.ComponentModel.ISupportInitialize)(this.yearUpDown)).EndInit();
      this.ResumeLayout(false);
      this.PerformLayout();

   }

  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.Run(new Form1());
  }

}



           
          


TreeView ImageIndex

   
 
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Form1 : System.Windows.Forms.Form {
    private System.Windows.Forms.TreeView treeView1;
    ImageList il = new ImageList();
    public Form1() {
        this.treeView1 = new System.Windows.Forms.TreeView();
        this.SuspendLayout();
        this.treeView1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
           | System.Windows.Forms.AnchorStyles.Left)
           | System.Windows.Forms.AnchorStyles.Right);
        this.treeView1.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
        this.treeView1.HotTracking = true;
        this.treeView1.ImageIndex = -1;
        this.treeView1.Indent = 30;
        this.treeView1.ItemHeight = 30;
        this.treeView1.LabelEdit = true;
        this.treeView1.Location = new System.Drawing.Point(8, 16);
        this.treeView1.SelectedImageIndex = -1;
        this.treeView1.Size = new System.Drawing.Size(360, 272);

        this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
        this.ClientSize = new System.Drawing.Size(376, 309);
        this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                      this.treeView1});
        this.Text = "TreeView Control";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.ResumeLayout(false);

    }
    [STAThread]
    static void Main() {
        Application.Run(new Form1());
    }

    private void Form1_Load(object sender, System.EventArgs e) {
        il.Images.Add(new Icon("1.ICO"));
        il.Images.Add(new Icon("2.ICO"));
        il.Images.Add(new Icon("3.ICO"));
        il.Images.Add(new Icon("4.ICO"));
        treeView1.ImageList = il;

        TreeNode rootNode = treeView1.Nodes.Add("USA");
        rootNode.ImageIndex = 0;

        TreeNode states1 = rootNode.Nodes.Add("a");
        states1.ImageIndex = 1;
        TreeNode states2 = rootNode.Nodes.Add("b");
        states2.ImageIndex = 1;
        TreeNode states3 = rootNode.Nodes.Add("c");
        states3.ImageIndex = 1;
        TreeNode states4 = rootNode.Nodes.Add("d");
        states4.ImageIndex = 1;

        TreeNode child = states1.Nodes.Add("A");
        child.ImageIndex = 2;
        child = states1.Nodes.Add("e");
        child.ImageIndex = 2;
        child = states1.Nodes.Add("f");
        child.ImageIndex = 2;

        child = states2.Nodes.Add("g");
        child.ImageIndex = 2;
        child = states2.Nodes.Add("h");
        child.ImageIndex = 2;
        child = states2.Nodes.Add("i");
        child.ImageIndex = 2;

        child = states3.Nodes.Add("j");
        child.ImageIndex = 2;
        child = states3.Nodes.Add("k");
        child.ImageIndex = 2;
        child = states3.Nodes.Add("l");
        child.ImageIndex = 2;

        child = states4.Nodes.Add("m");
        child.ImageIndex = 2;
        child = states4.Nodes.Add("n");
        child.ImageIndex = 2;
        child = states4.Nodes.Add("o");
        child.ImageIndex = 2;
    }
}

    


Unicode encoding: English


   


   using System;
   using System.Drawing;
   using System.Collections;
   using System.ComponentModel;
   using System.Windows.Forms;
   using System.Data;

   public class Unicode : System.Windows.Forms.Form {
      System.Windows.Forms.Label myLabel = new System.Windows.Forms.Label();

      public Unicode()
      {
         this.SuspendLayout();

         this.myLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 50.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.myLabel.Location = new System.Drawing.Point(20, 20);
         this.myLabel.Size = new System.Drawing.Size(800, 800);

         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(800, 200);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {this.myLabel});
         this.Name = "Unicode";
         this.Text = "Unicode";
         this.Load += new System.EventHandler(this.Unicode_Load);
         this.ResumeLayout(false);
      }

      [STAThread]
      static void Main() 
      {
         Application.Run(new Unicode());
      }

      private void Unicode_Load(object sender, System.EventArgs e)
      {
         // English
         char[] english = {'u0057', 'u0065', 'u006C',  
                             'u0063', 'u006F', 'u006D', 'u0065', 'u0020',
                             'u0074', 'u006F', 'u0020' };

         myLabel.Text = new string(english) + "Unicode" + 'u0021';
      }
   }

           
          


Unicode encoding: German


   

   using System;
   using System.Drawing;
   using System.Collections;
   using System.ComponentModel;
   using System.Windows.Forms;
   using System.Data;

   public class Unicode : System.Windows.Forms.Form {
      System.Windows.Forms.Label  myLabel = new System.Windows.Forms.Label();

      public Unicode()
      {
         this.SuspendLayout();

         this.myLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 50.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.myLabel.Location = new System.Drawing.Point(20, 20);
         this.myLabel.Size = new System.Drawing.Size(800, 800);

         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(800, 200);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {this.myLabel});
         this.Name = "Unicode";
         this.Text = "Unicode";
         this.Load += new System.EventHandler(this.Unicode_Load);
         this.ResumeLayout(false);
      }

      [STAThread]
      static void Main() 
      {
         Application.Run(new Unicode());
      }

      private void Unicode_Load(object sender, System.EventArgs e)
      {
         // German
         char[] german = {'u0057', 'u0069', 'u006C', 
                            'u006B', 'u006F', 'u006D', 'u006D', 'u0065',
                            'u006E', 'u0020', 'u007A', 'u0075', 'u0020'};

         myLabel.Text = new string(german) + "Unicode" + 'u0021';
      }
   }


           
          


Unicode encoding: French


   


   using System;
   using System.Drawing;
   using System.Collections;
   using System.ComponentModel;
   using System.Windows.Forms;
   using System.Data;

   public class Unicode : System.Windows.Forms.Form {
      System.Windows.Forms.Label  myLabel = new System.Windows.Forms.Label();

      public Unicode()
      {
         this.SuspendLayout();

         this.myLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 50.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
         this.myLabel.Location = new System.Drawing.Point(20, 20);
         this.myLabel.Size = new System.Drawing.Size(800, 800);

         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(800, 200);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {this.myLabel});
         this.Name = "Unicode";
         this.Text = "Unicode";
         this.Load += new System.EventHandler(this.Unicode_Load);
         this.ResumeLayout(false);
      }

      [STAThread]
      static void Main() 
      {
         Application.Run(new Unicode());
      }

      private void Unicode_Load(object sender, System.EventArgs e)
      {
         // French
         char[] french = { 'u0042', 'u0069', 'u0065', 
                            'u006E', 'u0076', 'u0065', 'u006E', 'u0075',
                            'u0065', 'u0020', 'u0061', 'u0075', 'u0020' };


         myLabel.Text = new string(french) + "Unicode" + 'u0021';
      }
   }

           
          


Add Nodes to TreeView

   
 

using System;
using System.Drawing;
using System.Windows.Forms;
   
class SimpleTreeView: Form
{
     public static void Main()
     {
          Application.Run(new SimpleTreeView());
     }
     public SimpleTreeView()
     {
          Text = "Simple Tree View";
   
          TreeView tree = new TreeView();
          tree.Parent = this;
          tree.Dock = DockStyle.Fill;
   
          tree.Nodes.Add("Animal");
          tree.Nodes[0].Nodes.Add("A");
          tree.Nodes[0].Nodes[0].Nodes.Add("A1");
          tree.Nodes[0].Nodes[0].Nodes.Add("A2");
          tree.Nodes[0].Nodes[0].Nodes.Add("A3");
          tree.Nodes[0].Nodes.Add("B");
          tree.Nodes[0].Nodes[1].Nodes.Add("B1");
          tree.Nodes[0].Nodes[1].Nodes.Add("B2");
          tree.Nodes[0].Nodes.Add("C");
          tree.Nodes[0].Nodes[2].Nodes.Add("C1");
          tree.Nodes[0].Nodes[2].Nodes.Add("C2");
          tree.Nodes[0].Nodes[2].Nodes.Add("C3");
          tree.Nodes.Add("D");
          tree.Nodes[1].Nodes.Add("D1");
          tree.Nodes[1].Nodes.Add("D2");
          tree.Nodes[1].Nodes.Add("D3");
          tree.Nodes.Add("E");
          tree.Nodes[2].Nodes.Add("E1");
          tree.Nodes[2].Nodes.Add("E2");
          tree.Nodes[2].Nodes.Add("E3");
     }
}