windowscript.cs

来自「经典编程900例(C语言),主要是C基础知识」· CS 代码 · 共 61 行

CS
61
字号
using System;
using System.DHTML;
using Ext;
using Ext.form;
using Ext.util;

namespace SampleScripts.window {
    public class HelloScript {
		private WindowClass _win;

        public static void main(Dictionary args) {
			ExtClass.onReady(new AnonymousDelegate(delegate() { new HelloScript().init(); }));
        }

		public void init() {
			Element button = ExtClass.get("show-btn");
			button.on("click", new ButtonClickDelegate(ShowWindow));

		}

		private void ShowWindow(Button button, EventObject evt)
		{
			if (_win == null)
			{
				_win = new Ext.WindowClass(new WindowConfig()
					.custom("el", "hello-win")
					.layout("fit")
					.width(500)
					.height(300)
					.closeAction("hide")
					.plain(true)

					.items(new TabPanel(new TabPanelConfig()
						.custom("el", "hello-tabs")
						.custom("autoTabs", true)
						.custom("activeTab", 0)
						.custom("deferredRender", false)
						.border(false)
						.ToDictionary()))

					.buttons(new object[] {
						new ButtonConfig()
							.text("Submit")
							.disabled(true)
							.ToDictionary(),
						new ButtonConfig()
							.text("Close")
							.handler(new DOMEventHandler(delegate { _win.hide(); }))
							.ToDictionary(),
					})

					.ToDictionary());
			}

			_win.show(button.getEl());
		}
    }


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?