private void SetThisWindowSize(int width, int height) { IVsWindowFrame w = (IVsWindowFrame)this.Frame; Guid m = Guid.Empty; w.SetFramePos(VSSETFRAMEPOS.SFP_fSize, ref m, 0, 0, width, height); }
void UpdateSubFrameSize() { Guid nullGuid = Guid.Empty; if (_subFrame != null) { ErrorHandler.ThrowOnFailure(_subFrame.SetFramePos(VSSETFRAMEPOS.SFP_fSize, ref nullGuid, xamlTextEditorContainer.Left, xamlTextEditorContainer.Top, xamlTextEditorContainer.Width, xamlTextEditorContainer.Height)); } }
private void DesignerPanel_SizeChanged(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); if (designerFrame != null) { Guid guidEmpty = Guid.Empty; Rectangle rcBounds = ((SplitterPanel)sender).Bounds; designerFrame.SetFramePos(VSSETFRAMEPOS.SFP_fSize | VSSETFRAMEPOS.SFP_fMove, ref guidEmpty, 0, 0, rcBounds.Width, rcBounds.Height); } }
/// <summary> /// Shows the tool window when the menu item is clicked. /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event args.</param> private void ShowToolWindow(object sender, EventArgs e) { // Get the instance number 0 of this tool window. This window is single instance so this instance // is actually the only one. // The last flag is set to true so that if the tool window does not exists it will be created. ToolWindowPane window = this.package.FindToolWindow(typeof(AccessibilityToolWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException("Cannot create tool window"); } var cx = (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Left + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Right) / 2; var cy = (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Top + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Bottom) / 2; IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; windowFrame.SetFramePos(VSSETFRAMEPOS.SFP_fFloat, Guid.Empty, cx, cy, cx + 800, cy + 800); Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); }
// -------------------------------------------------------------------------------------------- /// <summary> /// Sets the position of the window. /// </summary> /// <param name="dwSFP"> /// Frame position whose values are taken from the VSSETFRAMEPOS enumeration. /// </param> /// <param name="rguidRelativeTo">Not used.</param> /// <param name="x">Absolute x ordinate.</param> /// <param name="y">Absolute y ordinate.</param> /// <param name="cx">x ordinate relative to x.</param> /// <param name="cy">y ordinate relative to y.</param> /// <returns> /// If the method succeeds, it returns S_OK. If it fails, it returns an error code. /// </returns> // -------------------------------------------------------------------------------------------- int IVsWindowFrame.SetFramePos(VSSETFRAMEPOS dwSFP, ref Guid rguidRelativeTo, int x, int y, int cx, int cy) { return(_Frame.SetFramePos(dwSFP, ref rguidRelativeTo, x, y, cx, cy)); }