Position and size the Application window
(PresentationCore.dll을 참조추가 해야한다.)
using System.Drawing;using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
[CommandMethod("PositionApplicationWindow")]
public static void PositionApplicationWindow()
{
// Set the position of the Application window
//응용 프로그램 윈도우의 위치를 설정
Point ptApp = new Point(0, 0);
Application.MainWindow.Location = ptApp;
// Set the size of the Application window
//응용 프로그램 창의 크기를 설정
Size szApp = new Size(400, 400);
Application.MainWindow.Size = szApp;
}
Minimize and maximize the Application window
using System.Drawing;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows;
[CommandMethod("MinMaxApplicationWindow")]
public static void MinMaxApplicationWindow()
{
// Minimize the Application window
Application.MainWindow.WindowState = Window.State.Minimized;
System.Windows.Forms.MessageBox.Show("Minimized", "MinMax",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.None,
System.Windows.Forms.MessageBoxDefaultButton.Button1,
System.Windows.Forms.MessageBoxOptions.ServiceNotification);
// Maximize the Application window
Application.MainWindow.WindowState = Window.State.Maximized;
System.Windows.Forms.MessageBox.Show("Maximized", "MinMax");
}
Find the current state of the Application window
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows;
[CommandMethod("CurrentWindowState")]
public static void CurrentWindowState()
{
System.Windows.Forms.MessageBox.Show("The application window is " +
Application.MainWindow.WindowState.ToString(),
"Window State");
}
Make the Application window invisible and visible
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows;
[CommandMethod("HideWindowState")]
public static void HideWindowState()
{
// Hide the Application window
Application.MainWindow.Visible = false;
System.Windows.Forms.MessageBox.Show("Invisible", "Show/Hide");
// Show the Application window
Application.MainWindow.Visible = true;
System.Windows.Forms.MessageBox.Show("Visible", "Show/Hide");
}
출처
http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html
댓글 없음 :
댓글 쓰기