MarkX 发表于 2022-7-6 17:14:24

我不知道

我不是一个程序员,但我的老板希望我这样做,所以我会尽我最大的努力完成它。我需要创建一个userform,它可以为一个图形提供十种左右不同的选择规则。这些规则将根据选择规则中的参数打开和关闭图形中的图层。我发现了一些我认为可能有用的东西,但我不确定如何改变它们,或者我需要做什么才能让它们为我工作。这是我为层选择/过滤找到的代码。
 
Option Explicit

Public Function LayerSelection(strLayerName As String, strSSName) _
As AcadSelectionSet
Dim ssObjects As AcadSelectionSet
Dim intCode(0) As Integer
Dim varData(0) As Variant
Dim objCheck As AcadSelectionSet
'declare variables

intCode(0) = 8
'set variable for the dxf code for layer

varData(0) = strLayerName
'set variable for the layer name

Set ssObjects = ThisDrawing.SelectionSets.Add(strSSName)
'create a selection eset

ssObjects.Select acSelectionSetAll, , , intCode, varData
'select all entities on the specified layer

Set LayerSelection = ssObjects
'create a reference to the selection

End Function
 
这是我为用户表单找到的代码。
 
Private Sub UserForm_Click()
   Me.Height = Int(Rnd * 500)
   Me.Width = Int(Rnd * 750)
   
End Sub

Private Sub UserForm_Initialize()
   Me.Caption = "Userform Events"
   Me.BackColor = RGB(10, 25, 100)
   
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
   msg = "Now Unloading " & Me.Caption
   MsgBox prompt:=msg, Title:="QueryClose Event"
   
End Sub

Private Sub UserForm_Resize()
   msg = "Width: " & Me.Width & Chr(10) & "Height : " & Me.Height
   MsgBox prompt:=msg, Title:="Resizing Event"
   
End Sub

Private Sub UserForm_Terminate()
   msg = "Now Unloading " & Me.Caption
   MsgBox prompt:=msg, Title:="Terminate Event"
   
End Sub

 
就像我说的,我几乎没有做任何编程的经验,所以我能在这个问题上得到任何帮助都是很好的。

papagyi 发表于 2022-7-6 18:39:44

这个地方会帮你。。http://www.cadtutor.net/forum/forumdisplay.php?f=21
页: [1]
查看完整版本: 我不知道