Hi,
I have build my custom ToolWindowPane to be included into a VS2010 vsix package. I have set a starting width and height of the Frame of this Pane following the hints of this thread:
http://social.msdn.microsoft.com/forums/en-us/vsx/thread/84DBAE91-EE69-4081-B18A-5E3C37C1246F
Now I want to block the user to resize it.
I've tried to make a hack with the DTE, but with no luck.
For reference, my code is:
[Guid("6bb45379-c366-4c6e-9c43-51cb667ff402")] public class TestWindow : ToolWindowPane { private EnvDTE.WindowEvents WindowEvents { get; set; } // ... // constructor and initialize() method // ... public override void OnToolWindowCreated() { base.OnToolWindowCreated(); // set startup size SetThisWindowSize(585, 672); // block user resizing EnvDTE.DTE dte = EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); EnvDTE80.Events2 events = (EnvDTE80.Events2)dte.Events; this.WindowEvents = (EnvDTE.WindowEvents)events.get_WindowEvents(null); this.WindowEvents.WindowMoved += new EnvDTE._dispWindowEvents_WindowMovedEventHandler(ResetTheSize); } private void SetThisWindowSize(int width, int height) { IVsWindowFrame w = (IVsWindowFrame)s_instance.Frame; Guid m = Guid.Empty; w.SetFramePos(VSSETFRAMEPOS.SFP_fSize, ref m, 0, 0, width, height); } void ResetTheSize(EnvDTE.Window Window, int Top, int Left, int Width, int Height) { if (Window.ObjectKind.ToLower().CompareTo("{6bb45379-c366-4c6e-9c43-51cb667ff402}") != 0) return; if ((Width != 585) || (Height != 672)) SetThisWindowSize(585, 672); } } }
Any hints??
Thanks and Regards,
Matteo