AutoCAD .NET API 不包含任何用于访问通过“AutoCAD 选项”对话框访问的选项的类或方法。对这些选项的访问是通过 ActiveX® 自动化库完成的。使用从 Application 对象的属性返回的 COM 对象。Preferences 获得“首选项 COM”对象后,可以访问与选项相关的九个对象,每个对象表示“选项”对话框中的一个选项卡。这些对象提供对“选项”对话框中所有注册表存储选项的访问。您可以使用在这些对象上找到的特性来自定义许多 AutoCAD 设置。这些对象是
访问 Preferences 对象下面的示例演示如何通过 COM 互操作访问 Preferences 对象。 VB.NETDim acPrefComObj As AcadPreferences = Application.Preferences C#AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences; VBA/ActiveX 代码参考Dim acadPref as AcadPreferences Set acadPref = ThisDrawing.Application.Preferences 引用“首选项”对象后,可以使用“显示”、“绘图”、“文件”、“打开保存”、“输出”、“配置文件”、“选择”、“系统”和“用户”属性访问任何特定的“首选项”对象。 将十字准线设置为全屏VB.NETImports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.Interop <CommandMethod("PrefsSetCursor")> _ Public Sub PrefsSetCursor() '' This example sets the crosshairs of the AutoCAD drawing cursor '' to full screen. '' Access the Preferences object Dim acPrefComObj As AcadPreferences = Application.Preferences '' Use the CursorSize property to set the size of the crosshairs acPrefComObj.Display.CursorSize = 100 End Sub C#using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Interop; [CommandMethod("PrefsSetCursor")] public static void PrefsSetCursor() { // This example sets the crosshairs for the drawing window // to full screen. // Access the Preferences object AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences; // Use the CursorSize property to set the size of the crosshairs acPrefComObj.Display.CursorSize = 100; } VBA/ActiveX 代码参考Sub PrefsSetCursor() ' This example sets the crosshairs of the AutoCAD drawing cursor ' to full screen ' Access the Preferences object Dim acadPref As AcadPreferences Set acadPref = ThisDrawing.Application.Preferences ' Use the CursorSize property to set the size of the crosshairs acadPref.Display.CursorSize = 100 End Sub 隐藏滚动条VB.NETImports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.Interop <CommandMethod("PrefsSetDisplay")> _ Public Sub PrefsSetDisplay() '' This example disables the scroll bars '' Access the Preferences object Dim acPrefComObj As AcadPreferences = Application.Preferences '' Disable the scroll bars acPrefComObj.Display.DisplayScrollBars = False End Sub C#using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Interop; [CommandMethod("PrefsSetDisplay")] public static void PrefsSetDisplay() { // This example disables the scroll bars // Access the Preferences object AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences; // Disable the scroll bars acPrefComObj.Display.DisplayScrollBars = false; } VBA/ActiveX 代码参考Sub PrefsSetDisplay() ' This example disables the scroll bars ' Access the Preferences object Dim acadPref As AcadPreferences Set acadPref = ThisDrawing.Application.Preferences ' Disable the scroll bars acadPref.Display.DisplayScrollBars = False End Sub 父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:42
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.