Position and Size the Document Window

AutoCAD ActiveX

 
Position and Size the Document Window
 
 
 

Use the Document object to modify the position and size of any document window. The Document window can be minimized or maximized by using the WindowState property, and you can find the current state of the Document window by using the WindowState property.

Position a Document window

This example uses the Width and Height properties to set the active Document window to 400 pixels wide by 400 pixels high.

Sub Ch3_SizeDocumentWindow()
ThisDrawing.Width = 400
ThisDrawing.Height = 400
End Sub

Maximize the active Document window

Sub Ch3_MaximizeDocumentWindow()
ThisDrawing.WindowState = acMax
End Sub

Minimize the active Document window

Sub Ch3_MinimizeDocumentWindow()
ThisDrawing.WindowState = acMin
End Sub

Find the current state of the active Document window

Sub Ch3_CurrentWindowState()
 Dim CurrWindowState As Integer
 Dim msg As String
 CurrWindowState = ThisDrawing.WindowState
 msg = Choose(CurrWindowState, "normal", _
 "minimized", "maximized") 
 MsgBox "The document window is " + msg
End Sub