现在的位置: 首页 > 综合 > 正文

昨天的Python程序改写成JScript.NET了。

2013年10月01日 ⁄ 综合 ⁄ 共 1970字 ⁄ 字号 评论关闭

// 

//  Using directives

// 

import System;

import System.Data;

import System.Data.OleDb;

import System.Windows.Forms;

import System.Drawing;

 

//

//  Test form Class

//

class JSTest extends Form

{

    //  Button control

    private var button : Button;

    //  Treeview control

    private var treeview : TreeView;

 

    //  Constructor

    public function JSTest()

    {

        this.Text             = "Hello World";

        this.BackColor        = Color.LightGray;

       this.ClientSize          = new System.Drawing.Size(450, 220);

       this.StartPosition       = 1;

       this.FormBorderStyle = 0;

        this.Opacity          = 0.8;

        this.ShowInTaskbar    = false;

        this.TopMost          = true;

 

       this.button              = new Button();

        this.button.FlatStyle = 1;

        this.button.Dock      = 2;

        this.button.Text      = "Alert Text";

 

       this.treeview                    = new TreeView()

        this.treeview.BorderStyle        = 2

        this.treeview.Dock               = 5

 

       this.Controls.Add(this.button);

       this.Controls.Add(this.treeview);

 

       this.button.add_Click(this.button_Click);

       this.treeview.add_AfterSelect(this.treeView_AfterSelect);

       this.add_Load(this.JSTest_Load);

    }

 

    //  button click

    private function button_Click(sender, e : EventArgs)

    {

       MessageBox.Show(this.button.Text);

    }

 

    //  tree node click

    private function treeView_AfterSelect(sender, e : TreeViewEventArgs)

    {

        this.button.Text = e.Node.Text;

    }

 

    //  form load

    private function JSTest_Load(sender, e : EventArgs)

    {

        this.treeview.Nodes.Add("Java");

        this.treeview.Nodes[0].Nodes.Add("Struts");

        this.treeview.Nodes[0].Nodes.Add("Spring");

        this.treeview.Nodes[0].Nodes.Add("Hibernate");

        this.treeview.Nodes[0].Nodes.Add("Poolman");

        this.treeview.Nodes.Add("C#");

        this.treeview.Nodes[1].Nodes.Add("ADO.NET");

        this.treeview.Nodes[1].Nodes.Add("ASP.NET");

        this.treeview.Nodes[1].Nodes.Add("JScript.NET");

        this.treeview.Nodes.Add("Python");

    }

}

 

Application.Run(new JSTest());

 

抱歉!评论已关闭.