您的位置:首页 > 编程语言 > Python开发

Python第三天。

2004-08-11 19:03 344 查看
import CLR.System.Windows.Forms as WinForms
from CLR.System.Drawing import Size
from CLR.System.Drawing import Point
from CLR.System.Drawing import Color
from CLR.System.Drawing import SystemColors

class MacroApp(WinForms.Form):

def __init__(this):

this.Text = "Hello World"
this.BackColor = Color.LightGray
this.ClientSize = Size(450, 220)
this.FormBorderStyle = WinForms.FormBorderStyle.None
this.Opacity = 0.8
this.ShowInTaskbar = 0
this.TopMost = 1

this.button = WinForms.Button()
this.button.FlatStyle = 1
this.button.Dock = 2
this.button.Text = "Alert Text"

this.treeview = WinForms.TreeView()
this.treeview.BorderStyle = 2
this.treeview.Dock = 5

this.button.Click += this.button_Click
this.treeview.AfterSelect += this.treeView_AfterSelect
this.Load += this.MacroApp_Load

this.Controls.Add(this.button)
this.Controls.Add(this.treeview)

def button_Click(this, sender, args):

WinForms.MessageBox.Show(this, this.button.Text, this.button.Text, 4)

def MacroApp_Load(this, sender, args):

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")

def treeView_AfterSelect(this, sender, args):

this.button.Text = args.Node.Text

#StdThread
WinForms.Application.Run(MacroApp())

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: