.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Changing the document window size with vb.net
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I'm trying to change the active document window size with vb.net. This seems like it should be straightforward, but I'm having some trouble. Below is some code that I tried to use which I found on the AutoCAD DevBlog.. I thought I understood how this works, but I can't seem to import the correct references to make it work. Any help would be greatly appreciated.
Dim doc As Document = Application.DocumentManager.MdiActiveDocument()
Dim docWindow As Window = doc.Window
Dim size As Size = docWindow.Size
docWindow.WindowState = Window.State.Normal
docWindow.Size = New Size(500, 500)
Re: Changing the document window size with vb.net
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Windows
and changed size to drawing,size and it worked fine. in 2010
What was the error?

“We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”
Re: Changing the document window size with vb.net
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This works in Map 3D 2011. References are attached.
<CommandMethod("testwindow")> _
Public Sub testwindowsize()
Dim doc As acapp.Document = acapp.Application.DocumentManager.MdiActiveDocumen t()
Dim docWindow As Window = doc.Window
Dim size As Drawing.Size = docWindow.Size
docWindow.WindowState = Window.State.Normal
docWindow.Size = New Drawing.Size(500, 500)
End Sub
Re: Changing the document window size with vb.net
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the help, but it won't build with 2013.
I checked, and I have all of the references that fieldguy has. With acad 2013, I know a number of items have changed in .net. I've tried a number of combinations of imported namespaces, but I get a message stating that 'Type Size is not defined".
I can get this to work in earlier versions, but unfortunately, I need it to work in 2013.
Thanks
btm
Re: Changing the document window size with vb.net
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
There's a lot of changes in AutoCAD 2013 that break existing code.
See my response to your Swamp Post:

