void PositionCombo(EditorHeaderDropdown combo, ref Rectangle rect) { if (combo.Visible) { int width = combo.Width; combo.Bounds = new Rectangle(rect.Right - width, rect.Top, width, rect.Height); // rect.Offset(-width, 0); rect.Width -= width; } }
EditorHeaderDropdown AddCombo(string nam) { EditorHeaderDropdown combo = new EditorHeaderDropdown(nam); combo.BackColor = BackColor; combo.Click += new EventHandler(OnComboDropDown); dropdowns.Add(combo); Controls.Add(combo); return(combo); }
private void OnComboDropDown(object sender, EventArgs e) { EditorHeaderDropdown c = sender as EditorHeaderDropdown; string keyword = c.Text.ToLower(); if (Parser.querySuggestions.ContainsKey(keyword)) { Point pMouse = Cursor.Position; Point p = new Point(c.Left, c.Bottom); p = PointToScreen(p); autoSuggest.UpdateSuggestions(Parser.querySuggestions[keyword], p); } }
public EditorHeader(main f, AutoSuggest a) { autoSuggest = a; mainForm = f; InitializeComponent(); nextButton = CreateButton(0, "Next", new EventHandler(OnNextQuery)); prevButton = CreateButton(1, "Prev", new EventHandler(OnPrevQuery)); formatButton = CreateButton(9, "Format Query", new EventHandler(OnFormatQuery)); autoTableCheckbox = CreateCheckBox(11, "Auto From", new EventHandler(OnAutoFrom)); autoAliasCheckbox = CreateCheckBox(10, "Auto Alias", new EventHandler(OnAutoAlias)); autoTableCheckbox.Checked = S.Get("AutocompleteInsertTables", false); autoAliasCheckbox.Checked = S.Get("AutocompleteInsertAliases", false); queryCombo = AddCombo("Query"); selectCombo = AddCombo("Select"); fromCombo = AddCombo("From"); whereCombo = AddCombo("Where"); groupCombo = AddCombo("Group"); orderCombo = AddCombo("Order"); loading = false; }