c# - Winforms Accordion

标签 c# winforms accordion accordionpane

<分区>

有人知道 c# winforms Accordion 控件吗?

最好是开源的或免费的。

最佳答案

这是一个基本示例,它使用 CheckBox 控件,其中 Appearance 设置为 Button 作为 header 。 Download accordion.cs on sourceforge.

演示代码:

    Accordion acc = new Accordion();
    acc.CheckBoxMargin = new Padding(2);
    acc.ContentMargin = new Padding(15, 5, 15, 5);
    acc.ContentPadding = new Padding(1);
    acc.Insets = new Padding(5);
    acc.ControlBackColor = Color.White;
    acc.ContentBackColor = Color.CadetBlue;

    TableLayoutPanel tlp = new TableLayoutPanel { Dock = DockStyle.Fill, Padding = new Padding(5) };
    tlp.TabStop = true;
    tlp.Controls.Add(new Label { Text = "First Name", TextAlign = ContentAlignment.BottomLeft }, 0, 0);
    tlp.Controls.Add(new TextBox(), 1, 0);
    tlp.Controls.Add(new Label { Text = "Last Name", TextAlign = ContentAlignment.BottomLeft }, 0, 1);
    tlp.Controls.Add(new TextBox(), 1, 1);

    acc.Add(tlp,"Contact Info", "Enter the client's information.", 0, true);
    acc.Add(new TextBox { Dock = DockStyle.Fill, Multiline = true, BackColor = Color.White }, "Memo", "Additional Client Info", 1, true, contentBackColor:Color.Transparent);
    acc.Add(new Control(), "Other Info", "Miscellaneous information.");

enter image description here

关于c# - Winforms Accordion ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1303195/

相关文章:

c# - 将多个(例如图像和文本)内容复制到剪贴板以粘贴到 MS Office C# Winform 中

jquery - CSS Accordion 菜单,在 IE Quirks 模式下不起作用

python - Kivy:通过单击第一个内容中的按钮将第一个 Accordion 项目内容更改为另一个内容

c# - 指定的值包含无效的 HTTP header 字符

c# - 以编程方式获取sql server的默认备份路径

c# - 将对象绑定(bind)到文本框 C#

c# - 在 C# 窗体上绘制圆圈后,我怎么知道我点击了哪个圆圈?

css - Twitter Bootstrap Accordion 固定大小百分比

c# - 在 C# 中检测 USB 设备的插入和移除

c# - 该事件只能出现在 += 或 -= 错误的左侧