关于BLOCK UI的一些控件的用法,本人曾经使用的代码,拿出来共享:
Option Strict Off Imports NXOpen Imports NXOpen.BlockStyler Imports System.Runtime.InteropServices Namespace Bizca.NX.UIBlockStyler Public Module UIBlockStylerEx <System.Runtime.CompilerServices.Extension()> _ <Obsolete> Public Function GetPropertiesEx(ByVal block As NXOpen.BlockStyler.UIBlock) As UIBlockEx Return New UIBlockEx(block) End Function '#Region "ListBox" ' <System.Runtime.CompilerServices.Extension()> _ ' Public Sub SetListItems(ByVal ListBox As NXOpen.BlockStyler.ListBox, ByVal stringArray() As String) ' ListBox.GetProperties.SetStrings("ListItems", stringArray) ' End Sub ' <System.Runtime.CompilerServices.Extension()> _ ' Public Function GetListItems(ByVal ListBox As NXOpen.BlockStyler.ListBox) as String() ' Return ListBox.GetProperties.GetStrings("ListItems") ' End Function '#End Region End Module 'Public Class ListBoxEx ' Inherits NXOpen.BlockStyler.ListBox ' Private ower As NXOpen.BlockStyler.ListBox ' Public Sub New(ByVal block As NXOpen.BlockStyler.ListBox) ' Me.ower = block ' End Sub ' Property DDDD As String ' Public Shared Sub DSS() ' With New ListBoxEx(Nothing) ' .DDDD = "FFF" ' End With ' Dim AAAA = Function(X As NXOpen.Tag) ' Return NXOpen.Utilities.NXObjectManager.Get(X) ' End Function ' Dim WWW = AAAA(NXOpen.Tag.Null) ' End Sub 'End Class Public Class UIBlockEx Private ower As NXOpen.BlockStyler.UIBlock Public Sub New(ByVal block As NXOpen.BlockStyler.UIBlock) Me.ower = block End Sub #Region "General Properties" ''' <summary> ''' 【通用】设置UIBlock的是否不禁止 ''' </summary> ''' <value>[CSG] TRUE-Block 不禁止,FALSE-Block 禁止</value> ''' <returns>[CSG] TRUE-Block 不禁止,FALSE-Block 禁止</returns> ''' <remarks>[CSG] TRUE-Block 不禁止,FALSE-Block 禁止 </remarks> Public Property Enable As Boolean Get Return Me.ower.GetProperties.GetLogical("Enable") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("Enable", value) End Set End Property ''' <summary> ''' 【通用】设置UIBlock的是否展开(Block必须拥有自己的组) ''' </summary> ''' <value>[SG] TRUE- 展开,FALSE- 折叠</value> ''' <returns>[SG] TRUE- 展开,FALSE- 折叠</returns> ''' <remarks>Block必须拥有自己的组(设计时才可以指定)</remarks> Public Property Expanded As Boolean Get Return Me.ower.GetProperties.GetLogical("Expanded") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("Expanded", value) End Set End Property ''' <summary> ''' 【通用】标签 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>[CSG] Any String Value </remarks> Public Property Label As String Get Return Me.ower.GetProperties.GetString("Label") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("Label", value) End Set End Property ''' <summary> ''' 【通用】设置UIBlock的Show可见属性 ''' </summary> ''' <value>[CSG] TRUE-Block 可见,FALSE-Block 不可见</value> ''' <returns>[CSG] TRUE-Block 可见,FALSE-Block 不可见</returns> ''' <remarks>Sets the visibility of the block</remarks> Public Property Show As Boolean Get Return Me.ower.GetProperties.GetLogical("Show") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("Show", value) End Set End Property #End Region #Region "Selection" ''' <summary> ''' 【选择对象】自动推进 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>自动推进到下一个UIBlock</remarks> Public Property AutomaticProgression As Boolean Get Return Me.ower.GetProperties.GetLogical("AutomaticProgression") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("AutomaticProgression", value) End Set End Property ''' <summary> ''' 【选择对象】提示字符串 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>状态栏提示字符串</remarks> Public Property Cue As String Get Return Me.ower.GetProperties.GetString("Cue") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("Cue", value) End Set End Property ''' <summary> ''' 【选择对象】标签字符串 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property LabelString As String Get Return Me.ower.GetProperties.GetString("LabelString") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("LabelString", value) End Set End Property ''' <summary> ''' 【选择对象】点覆盖 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>是否启用捕捉点</remarks> Public Property PointOverlay As Boolean Get Return Me.ower.GetProperties.GetLogical("PointOverlay") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.setLogical("PointOverlay",value) End Set End Property ''' <summary> ''' 【选择对象】设置选择过滤器 ''' </summary> ''' <param name="maskAction"></param> ''' <param name="maskTriples"></param> ''' <remarks></remarks> Public Sub SetSelectionFilter(ByVal maskAction As NXOpen.Selection.SelectionAction, ByVal maskTriples() As NXOpen.Selection.MaskTriple) Me.ower.GetProperties.SetSelectionFilter("SelectionFilter", maskAction, maskTriples) End Sub ''' <summary> ''' 【选择对象】选择的对象 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property SelectedObjects As NXOpen.TaggedObject() Get Return Me.ower.GetProperties.GetTaggedObjectVector("SelectedObjects") End Get Set(ByVal value As NXOpen.TaggedObject()) If value IsNot Nothing Then Me.ower.GetProperties.SetTaggedObjectVector("SelectedObjects", value) End If End Set End Property ''' <summary> ''' 【选择对象】最后取消选择的对象 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public ReadOnly Property LastDeselectedObjects As NXOpen.TaggedObject() Get Return Me.ower.GetProperties.GetTaggedObjectVector("LastDeselectedObjects") End Get End Property ''' <summary> ''' 【选择对象】最后选择的对象 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public ReadOnly Property LastSelectedObjects As NXOpen.TaggedObject() Get Return Me.ower.GetProperties.GetTaggedObjectVector("LastSelectedObjects") End Get End Property ''' <summary> ''' 【选择对象】步骤的状态 ''' </summary> ''' <value>只有当初始化的时候才可以设置该属性</value> ''' <returns></returns> ''' <remarks>CIG Required[必须] Optional[可选] Satisfied[满意]</remarks> Public Property StepStatus As StepStatusEnum Get Return Me.ower.GetProperties.GetEnum("StepStatus") End Get Set(ByVal value As StepStatusEnum) Me.ower.GetProperties.SetEnum("StepStatus", value) End Set End Property ''' <summary> ''' 步骤的状态 ''' </summary> ''' <remarks></remarks> Public Enum StepStatusEnum ''' <summary> ''' 必要的 ''' </summary> ''' <remarks></remarks> [Required] = 0 ''' <summary> ''' 可选的 ''' </summary> ''' <remarks></remarks> [Optional] = 1 ''' <summary> ''' 满意的 ''' </summary> ''' <remarks></remarks> [Satisfied] = 2 End Enum ''' <summary> ''' 【选择对象】拾取点 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>选择对象时在屏幕上触击的点</remarks> Public ReadOnly Property PickPoint As NXOpen.Point3d Get Return Me.ower.GetProperties.GetPoint("PickPoint") End Get End Property ''' <summary> ''' 【指定光标位置】显示临时点 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>Specify Cursor Location</remarks> Public Property DisplayTemporaryPoint As Boolean Get Return Me.ower.GetProperties.GetLogical("DisplayTemporaryPoint") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("DisplayTemporaryPoint", value) End Set End Property ''' <summary> ''' 【指定光标位置】光标位置 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>Specify Cursor Location</remarks> Public Property CursorLocation As NXOpen.Point3d Get Return Me.ower.GetProperties.GetPoint("CursorLocation") End Get Set(ByVal value As NXOpen.Point3d) Me.ower.GetProperties.SetPoint("CursorLocation", value) End Set End Property ''' <summary> ''' 【Specify Point】【Specify Vector】点 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property Point As NXOpen.Point3d Get Return Me.ower.GetProperties.GetPoint("Point") End Get Set(ByVal value As NXOpen.Point3d) Me.ower.GetProperties.SetPoint("Point", value) End Set End Property ''' <summary> ''' 【Specify Vector】矢量 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property Vector As Vector3d Get Return Me.ower.GetProperties.GetVector("Vector") End Get Set(ByVal value As Vector3d) Me.ower.GetProperties.SetVector("Vector", value) End Set End Property #End Region Public Property LogicalValue As Boolean Get Return Me.ower.GetProperties.GetLogical("Value") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("Value", value) End Set End Property #Region "Enum Block" ''' <summary> ''' 【Enumeration】枚举值 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property EnumValue As Integer Get Return Me.ower.GetProperties.GetEnum("Value") End Get Set(ByVal value As Integer) Me.ower.GetProperties.SetEnum("Value", value) End Set End Property ''' <summary> ''' 【Enumeration】枚举字符串 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property EnumAsString As String Get Return Me.ower.GetProperties.GetEnumAsString("Value") End Get Set(ByVal value As String) Me.ower.GetProperties.SetEnumAsString("Value", value) End Set End Property ''' <summary> ''' 【Enumeration】枚举字符串数组成员 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property EnumMembers As String() Get Return Me.ower.GetProperties.GetEnumMembers("Value") End Get Set(ByVal value As String()) Me.ower.GetProperties.SetEnumMembers("Value", value) End Set End Property #End Region #Region "Expression" ''' <summary> ''' 【表达式】【线性尺寸】【角度尺寸】【半径尺寸】【轨迹上的尺寸(沿曲线的位置)】表达式 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property Formula As String Get Return Me.ower.GetProperties.GetString("Formula") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("Formula", value) End Set End Property ''' <summary> ''' 【线性尺寸】【半径尺寸】手柄方向 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property HandleOrientation As NXOpen.Vector3d Get Return Me.ower.GetProperties.GetVector("HandleOrientation") End Get Set(ByVal value As NXOpen.Vector3d) Me.ower.GetProperties.SetVector("HandleOrientation", value) End Set End Property ''' <summary> ''' 【角度尺寸】手柄X轴方向 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property HandleXAxis As NXOpen.Vector3d Get Return Me.ower.GetProperties.GetVector("HandleXAxis") End Get Set(ByVal value As NXOpen.Vector3d) Me.ower.GetProperties.SetVector("HandleXAxis", value) End Set End Property ''' <summary> ''' 【角度尺寸】手柄Z轴方向 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property HandleZAxis As NXOpen.Vector3d Get Return Me.ower.GetProperties.GetVector("HandleZAxis") End Get Set(ByVal value As NXOpen.Vector3d) Me.ower.GetProperties.SetVector("HandleZAxis", value) End Set End Property ''' <summary> ''' 【线性尺寸】【角度尺寸】【半径尺寸】手柄原点 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property HandleOrigin As NXOpen.Point3d Get Return Me.ower.GetProperties.GetPoint("HandleOrigin") End Get Set(ByVal value As NXOpen.Point3d) Me.ower.GetProperties.SetPoint("HandleOrigin", value) End Set End Property ''' <summary> ''' 【线性尺寸】【角度尺寸】【半径尺寸】【轨迹上的尺寸(沿曲线的位置)】显示焦点手柄 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property ShowFocusHandle As Boolean Get Return Me.ower.GetProperties.GetLogical("ShowFocusHandle") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("ShowFocusHandle", value) End Set End Property ''' <summary> ''' 【线性尺寸】【角度尺寸】【半径尺寸】显示手柄 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property ShowHandle As Boolean Get Return Me.ower.GetProperties.GetLogical("ShowHandle") End Get Set(ByVal value As Boolean) Me.ower.GetProperties.SetLogical("ShowHandle", value) End Set End Property #End Region ''' <summary> ''' 【String】字符串值 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property StringValue As String Get Return Me.ower.GetProperties.GetString("Value") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("Value", value) End Set End Property Public Property StringArrayValue As String() Get Return Me.ower.GetProperties.GetStrings("Value") End Get Set(ByVal value As String()) Me.ower.GetProperties.SetStrings("Value", value) End Set End Property Public Property IntegerValue As Integer Get Return Me.ower.GetProperties.GetInteger("Value") End Get Set(ByVal value As Integer) Me.ower.GetProperties.SetInteger("Value", value) End Set End Property Public Property DoubleValue As Double Get Return Me.ower.GetProperties.GetDouble("Value") End Get Set(ByVal value As Double) Me.ower.GetProperties.SetDouble("Value", value) End Set End Property #Region "Selection with Browse" ''' <summary> ''' 指定选择文件或文件夹的路径 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>任何代表有效的文件路径或文件夹路径的字符串。</remarks> Public Property Path As String Get Return Me.ower.GetProperties.GetString("Path") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("Path", value) End Set End Property ''' <summary> ''' 指定筛选器的格式为"*.txt,*.xml"。如果未设置此属性,嵌以.prt作为默认的过滤器。 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks>字符串值的格式为"*.txt,*.xml"。如果空白,则以.prt作为默认的过滤器。</remarks> Public Property Filter As String Get Return Me.ower.GetProperties.GetString("Filter") End Get Set(ByVal value As String) Me.ower.GetProperties.SetString("Filter", value) End Set End Property #End Region End Class End Namespace