本帖最后由 回家路上 于 2015-8-24 17:32 编辑
在msdn上学习JScript呢,遇到一个JScript的例子。试了试。用jsc将其编译成.exe文件,双击运行会有一个cmd窗口在其后面,这个能隐藏吗?
运行的JScript代码- import System;
- import System.Windows.Forms;
- import System.Drawing;
- import Accessibility;
-
- class EventTestForm extends Form{
- var btn : Button;
-
- function EventTestForm() {
- btn = new Button;
- btn.Text = "Fire Event";
- Controls.Add(btn);
- btn.add_Click(ButtonEventHandler1);
- btn.add_Click(ButtonEventHandler2);
- }
-
- function ButtonEventHandler1(sender, e : EventArgs) {
- MessageBox.Show("Event is Fired!");
- }
-
- function ButtonEventHandler2(sender, e : EventArgs) {
- MessageBox.Show("Another Event is Fired!");
- }
- }
-
- Application.Run(new EventTestForm);
复制代码
|