02-02 控制AutoCAD环境(二) 控制图形窗口(1)设置文档窗口的位置和大小

02-02 控制AutoCAD环境(二) 控制图形窗口(1)设置文档窗口的位置和大小,第1张

概述Control the Drawing Windows 控制图形窗口 (译者注:AutoCAD应用程序是多文档界面软件,英文为Multiple Document Interface,简称MDI。在AutoCAD主窗口内可以打开多个图形文档,而每个图形文档都拥有一个窗口。) Like the AutoCAD Application window, you can minimize, maximize

Control the Drawing windows

控制图形窗口

(译者注:autoCAD应用程序是多文档界面软件,英文为Multiple document Interface,简称MDI。在autoCAD主窗口内可以打开多个图形文档,而每个图形文档都拥有一个窗口。

like the autoCAD Application window,you can minimize,maximize,reposition,resize,and check the state of any document window. But you can also change the way the drawing is displayed within a window by using vIEws,vIEwports,and zooming methods.

autoCAD应用程序窗口一样,我们同样可以对任一图形文档窗口进行最小化、最大化、改变位置、改变大小以及检查状态等 *** 作。我们还可以通过使用视图、视口及缩放方法改变图形在窗口内的显示方式。

The autoCAD .NET API provIDes many ways to display your drawing. You can control the drawing display to move quickly to different areas of your drawing while you track the overall effect of your changes. You can zoom to change magnification or pan to reposition the vIEw in the graphics area,save a named vIEw and then restore it when you need to plot or refer to specific details,or display several vIEws at one time by splitting the screen into several tiled vIEwports.

autoCAD .NET API编程接口提供了许多显示图形的手段。当追踪所绘图形的整体效果时,我们可以控制图形显示快速移动到图形的不同区域,我们可以缩放或平移视图,保存命名视图并在需要打印或引用特定细节时恢复命名视图,或者通过将屏幕分割为多个平铺视口的方式来一次显示多个视图。

topics in this section

本节主题

l position and Size the document Window 设置文档窗口的位置和大小

l Zoom and Pan the Current VIEw 缩放和平移当前视图Use named VIEws 使用命名视图Use Tiled VIEwports 使用平铺视口Update the Geometry in the document Window 更新文档窗口的几何信息

1position 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.

使用document对象来调整文档窗口的位置和大小。可以用windowstate属性最大化和最小化文档窗口,还可以用windowstate属性获取文档窗口当前状态

Size the active document window 设置当前文档窗口大小

This example uses the Location and Size propertIEs to set the placement and size of document window to 400 pixels wIDe by 400 pixels high.

本例使用Location属性和Size属性设置文档窗口位置并将窗口大小设置为400像素宽400像素高。

VB.NET

imports autodesk.autoCAD.Runtime

imports autodesk.autoCAD.applicationservices

imports autodesk.autoCAD.windows

<CommandMethod("SizedocumentWindow")> _

Public Sub SizedocumentWindow()

'' Size the document window

Dim acDoc As document = Application.documentManager.MdiActivedocument

acDoc.Window.windowstate = Window.State.normal

'' Set the position of the document window

Dim ptDoc As Point = New Point(0,0)

acDoc.Window.Location = ptDoc

'' Set the size of the document window

Dim szDoc As Size = New Size(400,400)

acDoc.Window.Size = szDoc

End Sub

C#

using autodesk.autoCAD.Runtime;

using autodesk.autoCAD.applicationservices;

using autodesk.autoCAD.windows;

[CommandMethod("SizedocumentWindow")]

public static voID SizedocumentWindow()

{

// Get 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;

}

VBA/ActiveX Code Reference

Sub SizedocumentWindow()

ThisDrawing.WIDth = 400

ThisDrawing.Height = 400

End Sub

Minimize and maximize the active document window 最小化和最大化活动文档窗口

VB.NET

imports autodesk.autoCAD.Runtime

imports autodesk.autoCAD.applicationservices

imports autodesk.autoCAD.windows

<CommandMethod("MinMaxdocumentWindow")> _

Public Sub MinMaxdocumentWindow()

Dim acDoc As document = Application.documentManager.MdiActivedocument

'' Minimize the document window

acDoc.Window.windowstate = Window.State.Minimized

MsgBox("Minimized",MsgBoxStyle.SystemModal,"MinMax")

'' Maximize the document window

acDoc.Window.windowstate = Window.State.Maximized

MsgBox("Maximized","MinMax")

End Sub

C#

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");

}

Sub MinMaxdocumentWindow()

'' Minimize the document window

ThisDrawing.windowstate = acMin

MsgBox "Minimized"

'' Minimize the document window

ThisDrawing.windowstate = acMax

MsgBox "Maximized"

End Sub

Find the current state of the active document window 获取活动文档窗口的当前状态

VB.NET

imports autodesk.autoCAD.Runtime

imports autodesk.autoCAD.applicationservices

imports autodesk.autoCAD.windows

<CommandMethod("CurrentDocwindowstate")> _

Public Sub CurrentDocwindowstate()

Dim acDoc As document = Application.documentManager.MdiActivedocument

System.windows.Forms.MessageBox.Show("The document window is " & _

acDoc.Window.windowstate.ToString(),"Window State")

End Sub

C#

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");

}

Sub CurrentDocwindowstate()

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

总结

以上是内存溢出为你收集整理的02-02 控制AutoCAD环境(二) 控制图形窗口(1)设置文档窗口的位置和大小全部内容,希望文章能够帮你解决02-02 控制AutoCAD环境(二) 控制图形窗口(1)设置文档窗口的位置和大小所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1292540.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存