ICSharpCode.TextEditor.Gui.CompletionWindow.DeclarationViewWindow.GetRequiredLeftHandSideWidth C# (CSharp) Method

GetRequiredLeftHandSideWidth() public method

public GetRequiredLeftHandSideWidth ( Point p ) : int
p Point
return int
		public int GetRequiredLeftHandSideWidth(Point p) {
			if (description != null && description.Length > 0) {
				using (Graphics g = CreateGraphics()) {
					Size s = TipPainterTools.GetLeftHandSideDrawingSizeHelpTipFromCombinedDescription(this, g, Font, null, description, p);
					return s.Width;
				}
			}
			return 0;
		}
		

Usage Example

		void SetDeclarationViewLocation()
		{
			//  This method uses the side with more free space
			int leftSpace = Bounds.Left - workingScreen.Left;
			int rightSpace = workingScreen.Right - Bounds.Right;
			Point pos;
			// The declaration view window has better line break when used on
			// the right side, so prefer the right side to the left.
			if (rightSpace * 2 > leftSpace) {
				declarationViewWindow.FixedWidth = false;
				pos = new Point(Bounds.Right, Bounds.Top);
				if (declarationViewWindow.Location != pos) {
					declarationViewWindow.Location = pos;
				}
			} else {
				declarationViewWindow.Width = declarationViewWindow.GetRequiredLeftHandSideWidth(new Point(Bounds.Left, Bounds.Top));
				declarationViewWindow.FixedWidth = true;
				if (Bounds.Left < declarationViewWindow.Width) {
					pos = new Point(0, Bounds.Top);
				} else {
					pos = new Point(Bounds.Left - declarationViewWindow.Width, Bounds.Top);
				}
				if (declarationViewWindow.Location != pos) {
					declarationViewWindow.Location = pos;
				}
				declarationViewWindow.Refresh();
			}
		}
All Usage Examples Of ICSharpCode.TextEditor.Gui.CompletionWindow.DeclarationViewWindow::GetRequiredLeftHandSideWidth