CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

URLDescription Property (ActiveX)

2023-1-3 02:05| 发布者: admin| 查看: 1911| 评论: 0|来自: AutoCAD

摘要: 指定超链接对象的 URL 说明。

指定超链接对象的 URL 说明。

支持的平台:仅窗口

签名

工 务 局:

object.URLDescription
对象

类型:超链接

此属性适用的对象。

属性值

只读:

类型:字符串

一个字符串,表示对象的 URL 的说明。Hyperlink

言论

这在文件名或 URL 对识别文件内容不是很有帮助的情况下很有用。

例子

工 务 局:

Sub Example_URLDescription()
    ' This example creates a Circle object in model space and
    ' adds a new Hyperlink to its Hyperlink collection
    
    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim HLList As String
    
    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#
    
    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll
    
    ' Get reference to the Circle's Hyperlinks collection
    Set Hyperlinks = circleObj.Hyperlinks
    
    ' Add a new Hyperlink complete with all properties
    Set Hyperlink = Hyperlinks.Add("Autodesk")
    Hyperlink.URL = "www.autodesk.com"
    Hyperlink.URLDescription = "Autodesk Main Site"
    Hyperlink.URLNamedLocation = "MY_LOCATION"
    
    ' Read and display a list of existing Hyperlinks and
    ' their properties for this object
    For Each Hyperlink In Hyperlinks
        HLList = HLList & "____________________________________" & vbCrLf   ' Separator
        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf
        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next
    
    MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLList
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_URLDescription()
    ;; This example creates a Circle object in model space and
    ;; adds a new Hyperlink to its Hyperlink collection
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)  
          radius 5)
    
    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)
    
    ;; Get reference to the Circle's Hyperlinks collection
    (setq Hyperlinks (vla-get-Hyperlinks circleObj))
    
    ;; Add a new Hyperlink complete with all properties
    (setq Hyperlink (vla-Add Hyperlinks "Autodesk"))
    (vla-put-URL Hyperlink "www.autodesk.com")
    (vla-put-URLDescription Hyperlink "Autodesk Main Site")
    (vla-put-URLNamedLocation Hyperlink "MY_LOCATION")
    
    ;; Read and display a list of existing Hyperlinks and
    ;; their properties for this object
    (setq HLList "")
    (vlax-for Hyperlink Hyperlinks
        (setq HLList (strcat HLList "____________________________________"   ;; Separator
                             "\nURL: " (vla-get-URL Hyperlink)
                             "\nURL Description: " (vla-get-URLDescription Hyperlink)
                             "\nURL Named Location: " (vla-get-URLNamedLocation Hyperlink)))
    )
    
    (alert (strcat "The circle has " (itoa (vla-get-Count Hyperlinks)) " Hyperlink: \n"  HLList))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 17:19

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部