这个示例演示在 aardio 窗口中放置两个 custom 宿主控件,然后创建 AntdUI Button 与 Input。
import win.ui;
/*DSG{{*/
var winform = win.form(text="dotNet.AntdUI 快速上手";right=480;bottom=260)
winform.add(
btnHost={cls="custom.button";text="点我";left=40;top=40;right=180;bottom=78;z=1};
inputHost={cls="custom.edit";left=40;top=100;right=360;bottom=138;z=2}
);
/*}}*/
import dotNet.AntdUI;
var btn = AntdUI.Button(winform.btnHost);
btn.Type = AntdUI.TTypeMini.Primary;
var input = AntdUI.Input(winform.inputHost);
input.PlaceholderText = "这里显示按钮点击结果";
input.AllowClear = true;
btn.Click = function(sender,e){
input.Text = "Hello AntdUI";
}
winform.show();
win.loopMessage();
custom 控件决定 .NET 控件的位置与大小。import dotNet.AntdUI 后直接使用 AntdUI.Button(...)。sender,e 两个参数。