乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 44|回复: 2

求助,帮我看看错在哪里

[复制链接]

3

主题

6

帖子

4

银币

初来乍到

Rank: 1

铜币
18
发表于 2010-6-3 15:42:00 | 显示全部楼层 |阅读模式
Private Sub CommandButton1_Click()
Dim sSet As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim xx As AcadText
ftype(0) = 0
fdata(0) = "TEXT"
With ThisDrawing
On Error Resume Next
     If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
       Set sSet = .SelectionSets.Item("MySetSelectionSet")
       CreateSelectionSet.Delete
     End If
     Set sSet = .SelectionSets.Add("MySetSelectionSet")
End With
sSet.Select acSelectionSetAll, , , ftype, fdata
sco = sSet.Count

xx = sSet.Item(1)
ass.Delete
End Sub
我想用xx变量得到选择集内的某个元素(文字),这么写不对,该怎么写
回复

使用道具 举报

29

主题

503

帖子

8

银币

中流砥柱

Rank: 25

铜币
619
发表于 2010-6-3 16:29:00 | 显示全部楼层
1).CreateSelectionSet.Delete的CreateSelectionSet是否有误?是否应该为sSet
2).xx = sSet.Item(1)前面加上Set,对象赋值需要Set
3).ass.Delete的ass又是什么?
回复

使用道具 举报

3

主题

9

帖子

3

银币

初来乍到

Rank: 1

铜币
21
发表于 2010-6-5 11:16:00 | 显示全部楼层
Private Sub Test()
Dim sco As Integer
Dim sSet As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim xx As AcadText
ftype(0) = 0
fdata(0) = "TEXT"
With ThisDrawing
On Error Resume Next
     If Not IsNull(.SelectionSets.Item("MySetSelectionSet")) Then
       Set sSet = .SelectionSets.Item("MySetSelectionSet")
       sSet.Delete
     End If
     Set sSet = .SelectionSets.Add("MySetSelectionSet")
End With
sSet.Select acSelectionSetAll, , , ftype, fdata
sco = sSet.Count
Set xx = sSet.Item(1)
xx.color = acBlue
End Sub
这样可以了,你参考一下
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-1 15:09 , Processed in 0.311948 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表