aardio 文档

Drawer 抽屉

Drawer 是从窗口边缘滑出的浮层面板,适合承载详情页、筛选面板、设置面板和临时表单。与 Modal 不同,Drawer 更像侧边面板,可从上下左右弹出。

当前 DLL 的 Drawer 是静态类,常用 AntdUI.Drawer.open(form, content, align)AntdUI.Drawer.open(config)

基础示例

import win.ui;
import dotNet;
import dotNet.AntdUI;
import System.Windows.Forms;
import System.Drawing;

var winform = win.form(text="AntdUI Drawer";right=720;bottom=420)
winform.add(
customBase={cls="custom";left=0;top=0;right=720;bottom=420;z=1};
btn={cls="button";text="打开抽屉";left=40;top=40;right=180;bottom=76;z=2}
)

var baseForm = AntdUI.BaseForm(winform.customBase);

winform.btn.oncommand = function(){
    var panel = System.Windows.Forms.Panel();
    panel.Size = System.Drawing.Size(360,260);

    var title = System.Windows.Forms.Label();
    title.Text = "抽屉内容,可放表单、列表或设置项";
    title.Dock = System.Windows.Forms.DockStyle.Top;
    panel.Controls.Add(title);

    var cfg = AntdUI.Drawer.Config(baseForm,panel);
    cfg.Align = AntdUI.TAlignMini.Right;
    cfg.Padding = 24;
    cfg.Mask = true;
    AntdUI.Drawer.open(cfg);
}

winform.show();
win.loopMessage();

Config 常用字段

方向示例

var cfg = AntdUI.Drawer.Config(baseForm,panel);
cfg.Align = AntdUI.TAlignMini.Left;
cfg.Padding = 16;
cfg.MaskClosable = true;
AntdUI.Drawer.open(cfg);

常用方向:

open 快捷调用

如果不需要额外配置,可直接调用:

AntdUI.Drawer.open(baseForm,panel,AntdUI.TAlignMini.Right);

内容控件建议

Drawer 的内容必须是 .NET System.Windows.Forms.Control。常见做法:

  1. System.Windows.Forms.Panel() 作为容器,再往里添加 Label、Button、TextBox 等控件。
  2. 用 AntdUI 控件作为内容或子控件。
  3. 设置内容控件 Size,否则抽屉可能过小或布局不符合预期。

注意

Markdown 格式