Maximize the Visual Studio IDE from a macro?
While I'm perfectly willing to believe that this has been asked elsewhere, I haven't been able to find it.
I'm currently using macros to switch window layouts in Visual Studio by importing .vssettings files, but these files don't maintain the maximized state of the IDE (I have a single-screen layout that I want to be maximized, and a dual-screen layout that shouldn't be). I'd like to alter the two macros that load these settings to maximize or restore the IDE window, but so far I haven't been able to find a way to do this.
So, for the actual question: how can I maximize or restore the Visual Studio (2008) IDE window programmatical开发者_StackOverflowly via macros?
Can you catch the WindowCreated Event from the WindowEvents object and set the Window to Maximized state?
Private Sub WindowEvents_WindowCreated(ByVal Window As EnvDTE.Window) Handles WindowEvents.WindowCreated
Window.WindowState = vsWindowState.vsWindowStateMaximize
End Sub
This did it for me:
DTE.MainWindow().WindowState = vsWindowState.vsWindowStateMaximize
精彩评论