AntdUI 是 WinForms 控件库。aardio 中最稳妥的方式是在窗体上放置 custom 控件,再把这个 custom 作为构造参数传给 AntdUI 控件。
import win.ui;
import dotNet.AntdUI;
var winform = win.form(text="宿主控件";right=500;bottom=260);
winform.add(host={cls="custom";left=30;top=30;right=300;bottom=80;z=1});
var btn = AntdUI.Button(winform.host);
btn.Text = "AntdUI Button";
btn.Type = AntdUI.TTypeMini.Primary;
winform.show();
win.loopMessage();
如果一个 custom 宿主内需要放多个 AntdUI/WinForms 子控件,建议先创建 AntdUI.BaseForm 作为 .NET 容器。
import win.ui;
import dotNet.AntdUI;
import System.Drawing;
var winform = win.form(text="多控件宿主";right=520;bottom=260);
winform.add(host={cls="custom";left=0;top=0;right=520;bottom=260;z=1});
var baseForm = AntdUI.BaseForm(winform.host);
var input = AntdUI.Input();
input.Parent = baseForm;
input.Location = System.Drawing.Point(30,30);
input.Size = System.Drawing.Size(260,38);
input.PlaceholderText = "输入内容";
var btn = AntdUI.Button();
btn.Parent = baseForm;
btn.Location = System.Drawing.Point(310,30);
btn.Size = System.Drawing.Size(120,38);
btn.Text = "提交";
winform.show();
win.loopMessage();
custom 宿主。custom,或使用 AntdUI 的 Panel、StackPanel、FlowPanel、GridPanel 等容器。custom 的 dl/dt/dr/db 固定边距。AntdUI.BaseForm(winform.host)。