分享一下,最后用C#实现了我需要的功能。
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.AutoCAD.Runtime;
- using Autodesk.AutoCAD.ApplicationServices;
- using System.Drawing;
- using Autodesk.AutoCAD.Windows;
- namespace 调整CAD程序窗口
- {
- /// <summary>
- /// 用于将程序窗口改为右屏最大。
- /// </summary>
- public class WindowContrlA
- {
- [CommandMethod("W1")]
- public static void WindowPost() //调⽤HelloWorld 命令要调⽤的函数
- {
- Point ptApp = new Point(-9, -9); //设点为(0,0)
- Size szApp = new Size(1938, 1048); //设窗口大小为(500,500)
- Application.MainWindow.SetLocation(ptApp); //将程序窗口点设为(0,0)
- Application.MainWindow.SetSize(szApp); //将程序窗口大小设为(1920,1080)
- }
- }
- /// <summary>
- /// 用于将程序窗口改为双屏最大。
- /// </summary>
- public class WindowContrlB
- {
- [CommandMethod("W2")]
- public static void WindowPost() //调⽤HelloWorld 命令要调⽤的函数
- {
- Point ptApp = new Point(-1929, -9); //设点为(-1929,-9)
- Size szApp = new Size(3882, 1048); //设窗口大小为(3840,1080)
- Application.MainWindow.SetLocation(ptApp); //将程序窗口点设为(0,0)
- Application.MainWindow.SetSize(szApp); //将程序设窗口大小为(3840,1080)
- }
- }
- }
|