private void SetCompletionItems(Form parent, AutoCompleteContext context, string fileName, bool p1, bool p2) { _context = context; ICompletionData[] completionData = _context.CompletionProvider.GenerateCompletionData(fileName, _context.Editor.ActiveTextAreaControl.TextArea, _context.FirstChar); if (completionData == null || completionData.Length == 0) { _context = null; HideBox(); } else { this.ImageList = _context.CompletionProvider.ImageList; int width = 0; this.Items.Clear(); foreach (ICompletionData it in completionData) { AutoCompletionListBoxItem litem = new AutoCompletionListBoxItem(); litem.Text = it.Text; litem.ImageIndex = it.ImageIndex; litem.Tag = it; this.Items.Add(litem); int length = TextRenderer.MeasureText(it.Text, this.Font).Width + 30; //For icon size if (length > width) { width = length; } } this.Width = width + 30; this.BringToFront(); this.Show(); this.IsShown = true; Point pt = _context.GetCaretPoint(); this.Location = pt; } }
private void SetCompletionItems(Form parent, AutoCompleteContext context, string fileName, bool p1, bool p2) { _context = context; ICompletionData[] completionData = _context.CompletionProvider.GenerateCompletionData(fileName, _context.Editor.ActiveTextAreaControl.TextArea, _context.FirstChar); if (completionData == null || completionData.Length == 0) { _context = null; HideBox(); } else { this.ImageList = _context.CompletionProvider.ImageList; int width = 0; this.Items.Clear(); foreach (ICompletionData it in completionData) { AutoCompletionListBoxItem litem = new AutoCompletionListBoxItem(); litem.Text = it.Text; litem.ImageIndex = it.ImageIndex; litem.Tag = it; this.Items.Add(litem); int length = TextRenderer.MeasureText(it.Text, this.Font).Width + 30; //For icon size if (length > width) width = length; } this.Width = width + 30; this.BringToFront(); this.Show(); this.IsShown = true; Point pt = _context.GetCaretPoint(); this.Location = pt; } }