2012년 3월 9일 금요일

Position and Size the Document Window

Size the active Document window



using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows;

[CommandMethod("SizeDocumentWindow")]
public static void SizeDocumentWindow()
{
  // Size the Document window
  Document acDoc = Application.DocumentManager.MdiActiveDocument;
  acDoc.Window.WindowState = Window.State.Normal;

  // Set the position of the Document window
  Point ptDoc  = new Point(0, 0);
  acDoc.Window.Location = ptDoc;

  // Set the size of the Document window
  Size szDoc = new Size(400, 400);
  acDoc.Window.Size = szDoc;
}


Minimize and maximize the active Document window
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows;

[CommandMethod("MinMaxDocumentWindow")]
public static void MinMaxDocumentWindow()
{
  Document acDoc = Application.DocumentManager.MdiActiveDocument;

  // Minimize the Document window
  acDoc.Window.WindowState = Window.State.Minimized;
  System.Windows.Forms.MessageBox.Show("Minimized" , "MinMax");

  // Maximize the Document window
  acDoc.Window.WindowState = Window.State.Maximized;
  System.Windows.Forms.MessageBox.Show("Maximized" , "MinMax");
}

Find the current state of the active Document window
//현제상태
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Windows;

[CommandMethod("CurrentDocWindowState")]
public static void CurrentDocWindowState()
{
  Document acDoc = Application.DocumentManager.MdiActiveDocument;

  System.Windows.Forms.MessageBox.Show("The document window is " +
  acDoc.Window.WindowState.ToString(), "Window State");
}

출처
http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer%27s%20Guide/index.html


댓글 없음 :

댓글 쓰기