Yesterday's Python program is rewritten into JScript.net.

xiaoxiao2021-03-06  144

//

// 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;

// conncture

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 ());

转载请注明原文地址:https://www.9cbs.com/read-127923.html

New Post(0)