CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

重置配置文件方法 (ActiveX)

2023-1-4 04:13| 发布者: admin| 查看: 635| 评论: 0|来自: AutoCAD

摘要: 将指定配置文件中的值重置为其默认值。

将指定配置文件中的值重置为其默认值。

支持的平台:仅窗口

签名

工 务 局:

object.ResetProfile Profile
对象

类型:首选项配置文件

此方法适用的对象。

轮廓

访问:仅输入

类型:字符串

要重置的配置文件。

返回值(RetVal)

无返回值。

言论

指定的配置文件必须是当前活动配置文件。若要将配置文件设置为当前活动配置文件,请使用属性。ActiveProfile

例子

工 务 局:

Sub Example_ResetProfile()
    ' This example resets a profile to the default values.
    ' NOTE: A dummy profile name is used so that your existing
    ' profiles are not changed.
    
    Dim preferences As AcadPreferences
    Dim strProfileToReset As String
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Specify the profile to delete.
    strProfileToReset = "TestProfile"
    
    ' Delete the profile
    ' The call will fail if "TestProfile" does not exist
    On Error GoTo Error
    preferences.Profiles.ResetProfile strProfileToReset
    Exit Sub

Error:
    MsgBox "ResetProfile of " & strProfileToReset & " failed. " & Err.Description, , "ResetProfile Example"
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ResetProfile()
    ;; This example resets a profile to the default values.
    ;; NOTE: A dummy profile name is used so that your existing
    ;; profiles are not changed.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Specify the profile to delete.
    (setq strProfileToReset "TestProfile")
    
    ;; Reset the profile
    ;; The call will fail if "TestProfile" does not exist
    (setq err (vl-catch-all-apply 'vla-ResetProfile (list (vla-get-Profiles preferences) strProfileToReset)))

    (if (= (type err) 'VL-CATCH-ALL-APPLY-ERROR)
        (alert (strcat "ResetProfile of " strProfileToReset " failed. "))
        (alert (strcat "We have just reset the profile " strProfileToReset))
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部