Loading...
Loading...
Compare original and translation side by side
using Syncfusion.Windows.Forms.Tools;
// Create XPTaskBar control
XPTaskBar xpTaskBar1 = new XPTaskBar();
xpTaskBar1.Dock = DockStyle.Fill;
this.Controls.Add(xpTaskBar1);
// Create first task box
XPTaskBarBox box1 = new XPTaskBarBox();
box1.Text = "File Operations";
xpTaskBar1.Controls.Add(box1);
// Add items to the box
box1.Items.AddRange(new XPTaskBarItem[] {
new XPTaskBarItem("New Document", System.Drawing.Color.Empty, -1, "NewDoc"),
new XPTaskBarItem("Open File", System.Drawing.Color.Empty, -1, "OpenFile"),
new XPTaskBarItem("Save", System.Drawing.Color.Empty, -1, "Save")
});
// Handle item clicks
box1.ItemClick += (sender, e) => {
switch (e.XPTaskBarItem.Tag as string) {
case "NewDoc":
// Handle new document
break;
case "OpenFile":
// Handle file open
break;
}
};
// Create second task box
XPTaskBarBox box2 = new XPTaskBarBox();
box2.Text = "Editing Tools";
xpTaskBar1.Controls.Add(box2);
box2.Items.AddRange(new XPTaskBarItem[] {
new XPTaskBarItem("Cut", System.Drawing.Color.Empty, -1, "Cut"),
new XPTaskBarItem("Copy", System.Drawing.Color.Empty, -1, "Copy"),
new XPTaskBarItem("Paste", System.Drawing.Color.Empty, -1, "Paste")
});using Syncfusion.Windows.Forms.Tools;
// 创建XPTaskBar控件
XPTaskBar xpTaskBar1 = new XPTaskBar();
xpTaskBar1.Dock = DockStyle.Fill;
this.Controls.Add(xpTaskBar1);
// 创建第一个任务框
XPTaskBarBox box1 = new XPTaskBarBox();
box1.Text = "文件操作";
xpTaskBar1.Controls.Add(box1);
// 向框中添加条目
box1.Items.AddRange(new XPTaskBarItem[] {
new XPTaskBarItem("新建文档", System.Drawing.Color.Empty, -1, "NewDoc"),
new XPTaskBarItem("打开文件", System.Drawing.Color.Empty, -1, "OpenFile"),
new XPTaskBarItem("保存", System.Drawing.Color.Empty, -1, "Save")
});
// 处理条目点击事件
box1.ItemClick += (sender, e) => {
switch (e.XPTaskBarItem.Tag as string) {
case "NewDoc":
// 处理新建文档逻辑
break;
case "OpenFile":
// 处理打开文件逻辑
break;
}
};
// 创建第二个任务框
XPTaskBarBox box2 = new XPTaskBarBox();
box2.Text = "编辑工具";
xpTaskBar1.Controls.Add(box2);
box2.Items.AddRange(new XPTaskBarItem[] {
new XPTaskBarItem("剪切", System.Drawing.Color.Empty, -1, "Cut"),
new XPTaskBarItem("复制", System.Drawing.Color.Empty, -1, "Copy"),
new XPTaskBarItem("粘贴", System.Drawing.Color.Empty, -1, "Paste")
});var taskBar = new XPTaskBar { VerticalLayout = true };
// Create boxes for different task categories
foreach (var category in new[] { "File", "Edit", "View", "Help" }) {
var box = new XPTaskBarBox { Text = category };
taskBar.Controls.Add(box);
// Add items to box
}var taskBar = new XPTaskBar { VerticalLayout = true };
// 为不同任务分类创建框
foreach (var category in new[] { "文件", "编辑", "视图", "帮助" }) {
var box = new XPTaskBarBox { Text = category };
taskBar.Controls.Add(box);
// 向框中添加条目
}box.ItemClick += (sender, e) => {
var command = e.XPTaskBarItem.Tag as string;
ExecuteCommand(command);
};box.ItemClick += (sender, e) => {
var command = e.XPTaskBarItem.Tag as string;
ExecuteCommand(command);
};xpTaskBar1.AutoPersistStates = true;xpTaskBar1.AutoPersistStates = true;box.AnimationDelay = 50; // Milliseconds between frames
box.AnimationPositionsCount = 15; // Number of animation steps
box.UseAdditionalAnimation = true; // Animate when adding/removing itemsbox.AnimationDelay = 50; // 帧之间的间隔(毫秒)
box.AnimationPositionsCount = 15; // 动画步数
box.UseAdditionalAnimation = true; // 添加/移除条目时播放动画| Property | Type | Purpose |
|---|---|---|
| bool | Set true for vertical mode (default), false for horizontal |
| int | Column width in horizontal layout mode |
| int | Interior horizontal spacing |
| int | Interior vertical spacing |
| bool | Enable automatic scrollbars when needed |
| bool | Persist expanded/collapsed state between sessions |
| bool | Enable drag-and-drop support |
| Size | Minimum control dimensions |
| 属性 | 类型 | 用途 |
|---|---|---|
| bool | 设为true启用垂直模式(默认),false启用水平模式 |
| int | 水平布局模式下的列宽 |
| int | 内部水平间距 |
| int | 内部垂直间距 |
| bool | 需要时自动显示滚动条 |
| bool | 跨会话持久化展开/折叠状态 |
| bool | 启用拖拽支持 |
| Size | 控件最小尺寸 |
| Property | Type | Purpose |
|---|---|---|
| string | Box header display text |
| bool | Set true to collapse, false to expand |
| bool | Show/hide collapse button |
| bool | Allow button to toggle state |
| Color | Header background color |
| Color | Header text color |
| Font | Header text font |
| StringAlignment | Header text alignment |
| int | Delay in ms between animation frames |
| int | Number of animation steps |
| int | Height reserved for child controls |
| bool | Enable tooltips for items |
| int | Horizontal header padding |
| int | Vertical header padding |
| 属性 | 类型 | 用途 |
|---|---|---|
| string | 框头部展示文本 |
| bool | 设为true折叠,false展开 |
| bool | 显示/隐藏折叠按钮 |
| bool | 允许通过按钮切换状态 |
| Color | 头部背景色 |
| Color | 头部文本颜色 |
| Font | 头部文本字体 |
| StringAlignment | 头部文本对齐方式 |
| int | 动画帧之间的延迟(毫秒) |
| int | 动画步数 |
| int | 为子控件预留的高度 |
| bool | 启用条目提示框 |
| int | 头部水平内边距 |
| int | 头部垂直内边距 |
| Property | Type | Purpose |
|---|---|---|
| string | Item display text |
| int | Index in parent box's ImageList |
| string | Tooltip text on hover |
| object | Custom data for event routing |
| 属性 | 类型 | 用途 |
|---|---|---|
| string | 条目展示文本 |
| int | 父框ImageList中的图片索引 |
| string | hover时的提示文本 |
| object | 用于事件路由的自定义数据 |