ICSharpCode.TextEditor.Gui.CompletionWindow.CodeCompletionWindow.GetListViewWidth C# (CSharp) Метод

GetListViewWidth() приватный Метод

Gets the list view width large enough to handle the longest completion data text string.
private GetListViewWidth ( int defaultWidth, int height ) : int
defaultWidth int The default width of the list view.
height int The height of the list view. This is /// used to determine if the scrollbar is visible.
Результат int
		int GetListViewWidth(int defaultWidth, int height)
		{
			float width = defaultWidth;
			using (Graphics graphics = codeCompletionListView.CreateGraphics()) {
				for (int i = 0; i < completionData.Length; ++i) {
					float itemWidth = graphics.MeasureString(completionData[i].Text.ToString(), codeCompletionListView.Font).Width;
					if(itemWidth > width) {
						width = itemWidth;
					}
				}
			}
			
			float totalItemsHeight = codeCompletionListView.ItemHeight * completionData.Length;
			if (totalItemsHeight > height) {
				width += ScrollbarWidth; // Compensate for scroll bar.
			}
			return (int)width;
		}
	}