CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

相关分类

功能区元素 (.NET)

2023-1-1 08:33| 发布者: admin| 查看: 448| 评论: 0|来自: AutoCAD

摘要: 功能区为经常访问且与当前工作空间相关的工具提供了一个位置。

功能区为经常访问且与当前工作空间相关的工具提供了一个位置。

它被组织到选项卡中,这些选项卡类似于工具栏上的菜单。每个选项卡都包含一个或多个面板,其中包含执行不同操作的项目。

Autodesk.Windows是包含与功能区关联的类和枚举的托管命名空间。

制表符

选项卡是功能区内的初始导航界面。用于创建选项卡的类。RibbonTab

有两种类型:

  • 活动选项卡 - 这表示当前选定的选项卡。
  • ActiveContextualTab - 这表示仅当选定内容中包含特定类型的 AutoCAD 对象(如图案填充或表格)时才显示的选项卡。

面板包含与选项卡关联的所有工具。带有前缀的类控制面板的各个方面,例如其可见性、大小和浮动位置。RibbonPanel

RibbonRow对象定义面板中放置项目的行。这些行将添加到对象中,该对象包含功能区中显示的面板的面板定义。RibbonPanelSource

项目

项目可能是两种情况之一。它们可以是面板中包含的单个工具,例如按钮 () 或窗体 ();或者,它们可以是视觉分隔符(如行面板 () 或分隔符 ()。是这两种类型的父类。RibbonButtonRibbonFormRibbonRowPanelRibbonSeparatorRibbonItem

在项目本身中存在其他子类,例如,,或下面。有关这些子类型的详细信息,请参阅《ObjectARX 托管类参考指南》。RibbonDropDownButtonRibbonMenuButtonRibbonToggleButtonRibbonButton

功能区创建示例

以下是创建和填充对象的示例代码。这里的重要信息是遵循构造的层次结构,例如,必须将项目添加到面板,而面板必须添加到选项卡中。还有许多可自定义的属性可用于功能区,例如标题文本、大小、方向、工具提示和要显示的图像。Ribbon

VB.NET
'' First, the button items are created:
Dim button1 As RibbonButton = New RibbonButton()
button1.Text = "Button1"

Dim button2 As RibbonButton = New RibbonButton()
button2.Text = "Button2"

'' These are then added to a row:
Dim row As RibbonRow = New RibbonRow()
row.RowItems.Add(button1)
row.RowItems.Add(button2)

'' This row is added to a panel source, which is then added to a panel:
Dim panelSource As RibbonPanelSource = New RibbonPanelSource()
panelSource.Title = "Panel1"
panelSource.Rows.Add(row)

Dim panel As RibbonPanel = New RibbonPanel()
panel.Source = panelSource

'' Last, the panel is added to a tab, which is added to the ribbon:
Dim tab As RibbonTab = New RibbonTab()
tab.Title = "Tab1"
tab.Panels.Add(panel)

Dim ribbon As RibbonControl = New RibbonControl()
ribbon.Tabs.Add(tab)
C#
// First, the button items are created:
RibbonButton button1 = new RibbonButton;
button1.Text = "Button1";

RibbonButton button2 = new RibbonButton;
button2.Text = "Button2";

// These are then added to a row:
RibbonRow row = new RibbonRow();
row.RowItems.Add(button1);
row.RowItems.Add(button2);

// This row is added to a panel source, which is then added to a panel:
RibbonPanelSource panelSource = new RibbonPanelSource();
panelSource.Title = "Panel1";
panelSource.Rows.Add(row);

RibbonPanel panel = new RibbonPanel();
panel.Source = panelSource;

// Last, the panel is added to a tab, which is added to the ribbon:
RibbonTab tab = new RibbonTab();
tab.Title = "Tab1";
tab.Panels.Add(panel);

RibbonControl ribbon = new RibbonControl();
ribbon.Tabs.Add(tab);

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 13:59

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部