private static void lookForResult(bool showsError) { string studentID = textBoxSearchBox2.Text; if (studentID == "" || studentID.Replace(" ", "") == "" || studentID == "Student ID") { if (showsError) { MessageBox.Show("You must enter a student's ID before doing the searching!"); } listBoxSearchResult2.Hide(); return; } int studentIDResult; if (!int.TryParse(studentID, out studentIDResult)) { if (showsError) { MessageBox.Show("This is not a valid student ID!"); } else { listBoxSearchResult2.Show(); listBoxSearchResult2.BringToFront(); listBoxSearchResult2.Items.Clear(); listBoxSearchResult2.Items.Add("No Result Found!"); } return; } Dictionary <int, String> studentList = Program.getDatabaseUtils().getSimilarStudentName(studentIDResult); if (studentList == null || studentList.Count == 0) { if (showsError) { MessageBox.Show("Student Not Found!"); } else { listBoxSearchResult2.Show(); listBoxSearchResult2.BringToFront(); listBoxSearchResult2.Items.Clear(); listBoxSearchResult2.Items.Add("No Result Found!"); } return; } searchResults = studentList; listBoxSearchResult2.Show(); listBoxSearchResult2.BringToFront(); listBoxSearchResult2.Items.Clear(); foreach (KeyValuePair <int, String> result in studentList) { int studentId = Program.getDatabaseUtils().getUniqueIdByUserId("Student", "StudentID", result.Key); listBoxSearchResult2.Items.Add(studentId + " - " + result.Value); } }
/// <summary> /// 显示ListBox /// </summary> private bool ShowListBox() { try { // 如果为空,会异常,一般不会的 Control control = this; Point point = new Point() { X = 0, Y = 0 }; //坐标 while (control.Parent != null) { point.X = point.X + control.Location.X; point.Y = point.Y + control.Location.Y; control = control.Parent; } point.Y = point.Y + this.Height; //高度 //point.X = point.X + control.Location.X; //point.Y = point.Y + control.Location.Y + this.Height; control.Controls.Add(m_listBoxStation); m_listBoxStation.Width = this.Width; m_listBoxStation.Location = point; m_listBoxStation.TopIndex = 0; m_listBoxStation.BringToFront(); m_listBoxStation.Visible = true; return(true); } catch (System.Exception) { return(false); } }
/// <summary> /// Handles when a user presses a key down on the form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void frmSearchForItem_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && lbItemDisplay[0].Items.Count > 0) { sBarcodeOfProductSelected = lbItemDisplay[0].Items[lbItemDisplay[0].SelectedIndex].ToString().TrimEnd(' '); this.Close(); } else if (e.KeyCode == Keys.Escape) { lbCategories.BringToFront(); lbCategories.Visible = true; lbCategories.Focus(); lbCategories_KeyDown(sender, e); } else if (e.KeyCode == Keys.Right) { if (fsCurrentFormState == FormState.CategoryLookup) { DrawForm(FormState.BarcodeSearch); } else if (fsCurrentFormState == FormState.BarcodeSearch) { DrawForm(FormState.DescSearch); } else if (fsCurrentFormState == FormState.DescSearch) { DrawForm(FormState.CategoryLookup); } } }
private void TextChangeEvent(object sender, EventArgs e) { TextBox tbox = sender as TextBox; if (!tbox.Parent.Controls.Contains(lboxCity)) { lboxCity = new ListBox(); lboxCity.Visible = false; lboxCity.Click += new EventHandler(lboxCity_Click); tbox.Parent.Controls.Add(lboxCity); } if (!change) { tbox.Tag = null; string key = tbox.Text.Trim().ToLower(); if (key != "") { List <Station> stationList = StaticValues.StationList; List <Station> filterList = stationList.FindAll(p => p.ShortName.Contains(key) || p.ShortName1.Contains(key) || p.FullName.Contains(key) || p.Name.Contains(key)); if (filterList.Count > 0) { lboxCity.DisplayMember = "Name"; lboxCity.ValueMember = "Code"; lboxCity.DataSource = filterList; Point p1 = tbox.Location; lboxCity.Location = new Point(p1.X, p1.Y + tbox.Height + 4); lboxCity.Width = tbox.Width + 12; lboxCity.Show(); lboxCity.Tag = sender; lboxCity.BringToFront(); } } } }
/*[DllImport("user32")] * public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); * private void SetFixFont() * { * //メッセージを送り、RichTextのFontが勝手に変わるのを抑制する * int lPar; * lPar = SendMessage(this.Handle, EM_GETLANGOPTIONS, 0, 0); * lPar = lPar & (~IMF_DUALFONT); * SendMessage(this.Handle, EM_SETLANGOPTIONS, 0, lPar); * }*/ // private const uint IMF_DUALFONT = 0x80; // private const uint WM_USER = 0x0400; // private const uint EM_SETLANGOPTIONS = WM_USER + 120; // private const uint EM_GETLANGOPTIONS = WM_USER + 121; #endregion "メッセージ" #region "イベント" private void ExRichTextBox_TextChanged(object sender, EventArgs e) { int i = this.SelectionStart; //カレット位置 string s = this.Text.Substring(0, i); //カレット位置までの文字列取得 int c = -1; //区切り開始位置取得用 //単語の区切り位置を取得する処理 if (c < s.LastIndexOf(' ')) { c = s.LastIndexOf(' '); //半角空白位置取得 } if (c < s.LastIndexOf(' ')) { c = s.LastIndexOf(' '); //全角空白位置取得 } if (c < s.LastIndexOf('\t')) { c = s.LastIndexOf('\t'); //空白タブ位置取得 } if (c < s.LastIndexOf('\n')) { c = s.LastIndexOf('\n'); //改行(ラインフィールド)位置取得 } if (c < i) { //カレットの位置が前回の区切り位置より後なら _CurrentText = s.Substring(c + 1, i - c - 1); // Mid(s, c + 1, i - c); //現在編集中の単語取得 if (GetAutoCompleteList(FindType.Including)) //入力候補と入力中単語が一致するか判定 { listBox.Visible = true; //一致したら、ポップアップ表示 } else { listBox.Visible = false; //不一致なら、ポップアップ非表示 } } else { //区切り位置とカレット位置が同じ、もしくは前なら _CurrentText = ""; //編集中単語を空文字に listBox.Visible = false; //ポップアップ非表示 } if (listBox.Visible) { if (_ProcessFlag == false) { _CaretPosition = this.GetPositionFromCharIndex(this.SelectionStart); //カレットの現在位置ポイント取得 } listBox.BringToFront(); listBox.Top = _CaretPosition.Y + 15; listBox.Left = _CaretPosition.X + 5; listBox.IntegralHeight = false; int fullHeight = listBox.Items.Count * listBox.GetItemHeight(0); listBox.ClientSize = new Size(1, Math.Min(this.Height / 2, fullHeight)); listBox.ColumnWidth = 0; listBox.Top = Math.Min(this.Height - listBox.Height - 5, _CaretPosition.Y + 15); } }
public RemoteSwitchGUI() { Text = "Remote Switch GUI 1.0.1"; Size = new Size(300, 500); MinimumSize = new Size(260, 200); panel = new Panel(); panel.Parent = this; panel.Height = 40; panel.Dock = DockStyle.Top; listBox = new ListBox(); listBox.Parent = this; listBox.Dock = DockStyle.Fill; listBox.BringToFront(); buttonAOn = CreateButton("A On", 10, (1 << 0) | (1 << 2)); buttonAOff = CreateButton("A Off", 70, (1 << 0) | (1 << 3)); buttonBOn = CreateButton("B On", 130, (1 << 1) | (1 << 2)); buttonBOff = CreateButton("B Off", 190, (1 << 1) | (1 << 3)); Load += delegate(object sender, System.EventArgs e) { Thread thread = new Thread(delegate() { Connect(); }); thread.IsBackground = true; thread.Start(); }; }
// Show Menu Item "Server" private void showMenuItemServer() { butMenuReturn.Visible = true; menuItemHeader.Image = Image.FromFile("../../Resources/serverHeader.png"); menuItemHeader.Show(); addNameInput.BringToFront(); addIPInput.BringToFront(); addPortInput.BringToFront(); addServerBack.Show(); addNameInput.Show(); addIPInput.Show(); addPortInput.Show(); butAddServer.IsRound = true; butAddServer.RoundingArc = 10; butAddServer.BringToFront(); butAddServer.Show(); listServerBack.Show(); serverCheckList.BringToFront(); serverCheckList.Show(); butDeleteServer.IsRound = true; butDeleteServer.RoundingArc = 10; butDeleteServer.BringToFront(); butDeleteServer.Show(); }
private void getStations(string text, ListBox listBox) //Stationen werden geholt { try { if (text.Length >= 2) { listBox.Items.Clear(); Stations stations = transport.GetStations(text); foreach (Station station in stations.StationList) { listBox.Items.Add(station.Name); listBox.Visible = true; listBox.BringToFront(); } } } catch { MessageBox.Show("Geben sie einen Gültigen Wert ein!"); listBox.Visible = false; txtNach.Clear(); txtVon.Clear(); txtStation.Clear(); } }
/// <summary> /// /// </summary> static private void DisplayList(Object sender, System.Timers.ElapsedEventArgs e) { ITabbedDocument doc = PluginBase.MainForm.CurrentDocument; if (!doc.IsEditable) { return; } ScintillaControl sci = doc.SciControl; ListBox cl = completionList; if (cl.Items.Count == 0) { return; } // measure control if (needResize && widestLabel != null && widestLabel.Length > 0) { needResize = false; Graphics g = cl.CreateGraphics(); SizeF size = g.MeasureString(widestLabel, cl.Font); cl.Width = (int)Math.Min(Math.Max(size.Width + 40, 100), 400) + 10; } int newHeight = Math.Min(cl.Items.Count, 10) * cl.ItemHeight + 4; if (newHeight != cl.Height) { cl.Height = newHeight; } // place control Point coord = new Point(sci.PointXFromPosition(startPos), sci.PointYFromPosition(startPos)); listUp = UITools.CallTip.CallTipActive || (coord.Y + cl.Height > (sci as Control).Height); coord = sci.PointToScreen(coord); coord = ((Form)PluginBase.MainForm).PointToClient(coord); cl.Left = coord.X - 20 + sci.Left; if (listUp) { cl.Top = coord.Y - cl.Height; } else { cl.Top = coord.Y + UITools.Manager.LineHeight(sci); } // Keep on control area if (cl.Right > ((Form)PluginBase.MainForm).ClientRectangle.Right) { cl.Left = ((Form)PluginBase.MainForm).ClientRectangle.Right - cl.Width; } if (!cl.Visible) { cl.Show(); cl.BringToFront(); if (UITools.CallTip.CallTipActive) { UITools.CallTip.PositionControl(sci); } } }
private void button4_Click(object sender, EventArgs e) { hst.Visible = false; renk_kanali.Visible = false; dondurliste.Visible = false; genislik_txt.Visible = false; yukseklik_txt.Visible = false; if (ekran.Image == null) { MessageBox.Show("Önce Bir Resim Seçin"); } else { geri = new Bitmap(ekran.Image); arka_geri = new Bitmap(arka_resim); this.Controls.Add(aynaliste); aynaliste.BringToFront(); aynaliste.Visible = true; resize.Visible = false; } }
private void BuildListBox() { if (!_isAdded) { Control oParrentControl = this.MainControl; if (oParrentControl == null) { throw new Exception("Please set MainControl for " + this.Name); } oParrentControl.Controls.Add(_ListSuggestion); _ListSuggestion.TabIndex = this.TabIndex; _isAdded = true; } if (_isAdded) { Point oPoin = this.GetPositionFromCharIndex(this.SelectionStart - 1); int pY = this.Parent.Location.Y; _ListSuggestion.Width = Width - 12; _ListSuggestion.Left = this.Left + 12; _ListSuggestion.Top = pY + this.Top + oPoin.Y + 20; _ListSuggestion.BringToFront(); } }
ListBox listBox; // the only listbox, which is hidden and, when needed, moved and filled before it is shown public void ShowListBox(Rectangle screenLocation, string[] items, int selected, IPropertyEntry sender) { if (EntryWithListBox == sender) { return; } EntryWithListBox = sender; int height = items.Length * screenLocation.Height + 2 * SystemInformation.BorderSize.Height + listBox.Margin.Top + listBox.Margin.Bottom; Rectangle entryRect = RectangleToClient(screenLocation); Rectangle bounds; if (entryRect.Top > ClientRectangle.Height - entryRect.Bottom) { // place the list box above the entry height = Math.Min(height, entryRect.Top); bounds = new Rectangle(entryRect.Left, entryRect.Top - height, entryRect.Width, height); } else { // place the list box below the entry height = Math.Min(height, ClientRectangle.Height - entryRect.Bottom); bounds = new Rectangle(entryRect.Left, entryRect.Bottom, entryRect.Width, height); } listBox.Items.AddRange(items); listBox.Visible = true; listBox.BringToFront(); listBox.ItemHeight = screenLocation.Height; listBox.SelectedIndex = selected; listBox.Bounds = bounds; listBox.Show(); listBox.Focus(); }
/// <summary> /// Asigna el evento "Enter" a los controles para esconder los listbox /// que hayan sido marcados como predictivos /// </summary> /// <param name="ctls"></param> private void SetEnterEventTextBox(Control ctls) { foreach (Control c in ctls.Controls) { if (c is ListBox) { ListBox lb = c as ListBox; if (lb.Tag != null) { if (!(string.IsNullOrEmpty(lb.Tag.ToString()))) { c.Enter += new EventHandler(c_Enter); } else { lb.BringToFront(); } } } else { c.Enter += new EventHandler(c_Enter); if (c.HasChildren) { SetListBox(c); } } } }
private void PREBusinessesComboBox_TextChanged(object sender, EventArgs e) { listbox1.Visible = false; if (!this.Parent.Controls.Contains(listbox1)) { this.Parent.Controls.Add(listbox1); } listbox1.Width = this.Width; listbox1.Location = new System.Drawing.Point(this.Left, this.Top + this.Height); if (string.IsNullOrEmpty(this.Text)) { return; } PreferentialReportSearchCondition con = new PreferentialReportSearchCondition(); con.BusinessName = this.Text; PREBusinessesBll bll = new PREBusinessesBll(AppSettings.CurrentSetting.ParkConnect); List <PREBusinesses> items = bll.GetBusinesses(con).QueryObjects; if (items.Count > 0) { listbox1.DataSource = items; listbox1.ValueMember = "BusinessesID"; listbox1.DisplayMember = "BusinessesName"; listbox1.Visible = true; listbox1.BringToFront(); } }
private void picClick(object sender, EventArgs e) { if (listui != null) { listui.Dispose(); listui = null; } if (a1lable != null) { a1lable.Dispose(); } if ((sender is PictureBox) && ((MouseEventArgs)e).Button == MouseButtons.Right) { listui = new ListBox(); listui.Left = Cursor.Position.X - SystemInformation.PrimaryMonitorSize.Width + 190; listui.Top = Cursor.Position.Y; cursY = Cursor.Position.Y; cursX = Cursor.Position.X; // listui.Items.Add("открыть"); listui.Items.Add("открыть"); listui.Items.Add("удалить"); listui.Items.Add("свойства"); listui.SelectedIndexChanged += inedxchange; panel1.Controls.Add(listui); listui.BringToFront(); } }
private void lFavCheck_Click(object sender, EventArgs e) { if (MainWindow.FavList.Contains(DataIndex) == false) { MainWindow.AddFavList(DataIndex); } else { MainWindow.DeleteFavList(DataIndex); } lFavCheck_Icon(true); MainWindow.UpdateData(MainWindow.FavList, FavListView); if (MabiCooker.DetailView != null) { MabiCooker.DetailView.UpdateData(DataIndex, SelectedCook); } if (MainWindow.FavList.Count != 0) { FavListView.BringToFront(); } else { FavListView.SendToBack(); } }
void timer_Tick(object sender, EventArgs e) { timer.Stop(); Search(); lbData.Visible = lbData.Items.Count > 0; lbData.BringToFront(); }
private void ShowListBox() { if (!_isAdded) { //Form parentForm = this.FindForm(); // new line added //parentForm.Controls.Add(_listBox); // adds it to the form Parent.Controls.Add(_listBox); // adds it to the form _isAdded = true; } if (!_listBox.Visible) { Point pt; using (Graphics g = Graphics.FromHwnd(Handle)) { var start = GetStartOfCurrentWord(); pt = GetPositionFromCharIndex(start); if (SelectionStart == 0) { pt.X = 0; } } _listBox.Left = pt.X + Left; _listBox.Top = pt.Y + Top + Font.Height + 6; } _listBox.Visible = true; _listBox.BringToFront(); }
private void showList() { if (_listBox.Visible) { //_listBox.Width = (max_str_len * 7 > _textBox.Width ? max_str_len * 7 : _textBox.Width) + 25; //_listBox.Invalidate(true); return; } Form f = _textBox.FindForm(); if (f != null) { _listBox.Parent = f; Point _offset_text = _textBox.PointToScreen(_textBox.Location); Point _offset_form = f.PointToScreen(new Point(0, 0)); _listBox.HorizontalScrollbar = true; _listBox.Left = _offset_text.X - _offset_form.X - 10; _listBox.Top = _offset_text.Y - _offset_form.Y + _textBox.Height - 1; _listBox.Width = (max_str_len * 6 > _textBox.Width ? max_str_len * 6: _textBox.Width) + 25; _listBox.Height = _textBox.Height * ((_listBox.Items.Count > 10) ? 10 : _listBox.Items.Count) + 50; _listBox.Visible = true; _listBox.BringToFront(); if (!hooked_clicked) { hookControlsRecursive(f.Controls); hookFormClick(f); hooked_clicked = true; } //SetChildIndex //_listBox.Top = _textBox.Top + 30; } }
static private void DisplayList(object sender, System.Timers.ElapsedEventArgs e) { ScintillaControl sci = UITools.MainForm.CurSciControl; ListBox cl = completionList; if (cl.Items.Count == 0) { return; } // evaluate position cl.Height = Math.Min(cl.Items.Count, 10) * cl.ItemHeight + 4; Point coord = new Point(sci.PointXFromPosition(startPos), sci.PointYFromPosition(startPos)); listUp = (coord.Y + cl.Height > (sci as Control).Height); coord = sci.PointToScreen(coord); coord = ((Form)UITools.MainForm).PointToClient(coord); cl.Left = coord.X - 20 + sci.Left; if (listUp) { cl.Top = coord.Y - cl.Height + sci.Top; } else { cl.Top = coord.Y + UITools.LineHeight(sci) + sci.Top; } // if (!cl.Visible) { cl.Show(); cl.BringToFront(); } }
private void uctxtMedicalRep_GotFocus(object sender, System.EventArgs e) { lstMedicalRep.Visible = true; lstMedicalRep.ValueMember = "strLedgerName"; lstMedicalRep.DisplayMember = "strLedgerName"; lstMedicalRep.DataSource = accms.mFillLedgerList(203).ToList(); lstMedicalRep.BringToFront(); }
public void Setup() { box.FormattingEnabled = true; box.Location = new System.Drawing.Point(0, 0); box.Name = "momom"; box.Size = new System.Drawing.Size(296, 199); box.TabIndex = 6; box.BringToFront(); }
public void RefreshMemDisplay() { lb.BringToFront(); for (int i = 0; i < 4096; i++) { lb.Items.Add("0x" + i.ToString("X") + " == " + Memory.memory[i].ToString("X")); } //lb.Refresh(); }
// Show Menu Item "Network Devices" private void showMenuItemNetworkDevices() { butMenuReturn.Visible = true; menuItemHeader.Image = Image.FromFile("../../Resources/networkDevicesHeader.png"); menuItemHeader.Show(); listNetDevBack.Show(); netDevList.BringToFront(); netDevList.Show(); }
/// <summary> /// Whenever the list box becomes visible, adjust its position /// </summary> protected void lbSuggest_VisibleChanged(object sender, EventArgs e) { if (lbSuggest.Visible) { lbSuggest.Width = Width; lbSuggest.Left = Left; lbSuggest.Top = Bottom; lbSuggest.BringToFront(); } }
private void InitializeLiveListBox(Form parentForm) { liveListBox = new ListBox(); liveListBox.Parent = parentForm; liveListBox.BringToFront(); AddLiveBoxEvents(); liveListBox.DoubleBuffered(true); liveListBox.Visible = false; liveBoxGraphics = liveListBox.CreateGraphics(); SetStyle(); }
private void ShowListBox() { this.Parent.Parent.Controls.Add(_listBox); Point loc = this.Parent.PointToScreen(new Point(this.Left, this.Bottom)); Point parentLoc = this.Parent.Parent.PointToClient(loc); _listBox.Location = parentLoc; _listBox.Width = this.Width; _listBox.BringToFront(); _listBox.Show(); _listBoxShow = true; }
private void ShowListBox() { if (!_isAdded) { Parent.Controls.Add(_listBox); _listBox.Left = Left; _listBox.Top = Top + Height; _isAdded = true; } _listBox.Visible = true; _listBox.BringToFront(); }
void Parent_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (moreTabRect.Contains(e.X, e.Y)) { if (morelistbox.Visible) { morelistbox.Visible = false; morelistbox.DataSource = null; } else { morelistbox.DataSource = moretabtablelist; var maxwidth = 0; foreach (var item in moretabtablelist) { var w = this.CreateGraphics().MeasureString(item.Text, morelistbox.Font); if (w.Width > maxwidth) { maxwidth = (int)w.Width; } } morelistbox.Width = maxwidth; morelistbox.DisplayMember = "Text"; morelistbox.Location = new Point(moreTabRect.X - morelistbox.Width - 1, moreTabRect.Height * 2); morelistbox.Visible = true; morelistbox.BringToFront(); } } else { foreach (var tab in tabExDic) { if (tab.Value.StripRect.Contains(e.X, e.Y)) { if (this.SelectedIndex != tab.Key) { this.SelectedIndex = tab.Key; this.Invalidate(); } else if (tab.Value.CloseButtonBand.Contains(e.X, e.Y)) { this.TabPages.Remove(tab.Value.TabPage); break; } } } } } }
private void EnsureControlVisibility(ListBox editor) { var preferredHeight = editor.ItemHeight * Math.Min(editor.Items.Count, ListBoxItemsNumber); editor.Height = Math.Min(preferredHeight, parentTree.Height); if (parentTree.Height - editor.Bounds.Top < editor.Height) { editor.Bounds = new Rectangle(editor.Bounds.Left, parentTree.Height - editor.Height, editor.Bounds.Width, editor.Bounds.Height); } editor.BringToFront(); }