当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.BringToFront方法代码示例

本文整理汇总了C#中System.Windows.Forms.ListBox.BringToFront方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.BringToFront方法的具体用法?C# ListBox.BringToFront怎么用?C# ListBox.BringToFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ListBox的用法示例。


在下文中一共展示了ListBox.BringToFront方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormPatientAddAll

 public FormPatientAddAll()
 {
     InitializeComponent();
     Lan.F(this);
     listReferral=new ListBox();
     listReferral.Location=new Point(textReferral.Left,textReferral.Bottom);
     listReferral.Size=new Size(400,140);
     listReferral.HorizontalScrollbar=true;
     listReferral.Visible=false;
     listReferral.Click += new System.EventHandler(listReferral_Click);
     listReferral.DoubleClick += new System.EventHandler(listReferral_DoubleClick);
     listReferral.MouseEnter += new System.EventHandler(listReferral_MouseEnter);
     listReferral.MouseLeave += new System.EventHandler(listReferral_MouseLeave);
     Controls.Add(listReferral);
     listReferral.BringToFront();
     listEmps1=new ListBox();
     listEmps1.Location=new Point(groupIns1.Left+textEmployer1.Left,
         groupIns1.Top+textEmployer1.Bottom);
     listEmps1.Size=new Size(254,100);
     listEmps1.Visible=false;
     listEmps1.Click += new System.EventHandler(listEmps1_Click);
     listEmps1.DoubleClick += new System.EventHandler(listEmps1_DoubleClick);
     listEmps1.MouseEnter += new System.EventHandler(listEmps1_MouseEnter);
     listEmps1.MouseLeave += new System.EventHandler(listEmps1_MouseLeave);
     Controls.Add(listEmps1);
     listEmps1.BringToFront();
     listEmps2=new ListBox();
     listEmps2.Location=new Point(groupIns2.Left+textEmployer2.Left,
         groupIns2.Top+textEmployer2.Bottom);
     listEmps2.Size=new Size(254,100);
     listEmps2.Visible=false;
     listEmps2.Click += new System.EventHandler(listEmps2_Click);
     listEmps2.DoubleClick += new System.EventHandler(listEmps2_DoubleClick);
     listEmps2.MouseEnter += new System.EventHandler(listEmps2_MouseEnter);
     listEmps2.MouseLeave += new System.EventHandler(listEmps2_MouseLeave);
     Controls.Add(listEmps2);
     listEmps2.BringToFront();
     listCars1=new ListBox();
     listCars1.Location=new Point(groupIns1.Left+textCarrier1.Left,
         groupIns1.Top+textCarrier1.Bottom);
     listCars1.Size=new Size(700,100);
     listCars1.HorizontalScrollbar=true;
     listCars1.Visible=false;
     listCars1.Click += new System.EventHandler(listCars1_Click);
     listCars1.DoubleClick += new System.EventHandler(listCars1_DoubleClick);
     listCars1.MouseEnter += new System.EventHandler(listCars1_MouseEnter);
     listCars1.MouseLeave += new System.EventHandler(listCars1_MouseLeave);
     Controls.Add(listCars1);
     listCars1.BringToFront();
     listCars2=new ListBox();
     listCars2.Location=new Point(groupIns2.Left+textCarrier2.Left,
         groupIns2.Top+textCarrier2.Bottom);
     listCars2.Size=new Size(700,100);
     listCars2.HorizontalScrollbar=true;
     listCars2.Visible=false;
     listCars2.Click += new System.EventHandler(listCars2_Click);
     listCars2.DoubleClick += new System.EventHandler(listCars2_DoubleClick);
     listCars2.MouseEnter += new System.EventHandler(listCars2_MouseEnter);
     listCars2.MouseLeave += new System.EventHandler(listCars2_MouseLeave);
     Controls.Add(listCars2);
     listCars2.BringToFront();
 }
开发者ID:nampn,项目名称:ODental,代码行数:62,代码来源:FormPatientAddAll.cs

示例2: EnsureControlVisibility

        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();
        }
开发者ID:ubailey,项目名称:VersionOne.Client.VisualStudio,代码行数:10,代码来源:NodeListBox.cs

示例3: FormPatientEdit

 ///<summary></summary>
 public FormPatientEdit(Patient patCur,Family famCur)
 {
     InitializeComponent();// Required for Windows Form Designer support
     PatCur=patCur;
     FamCur=famCur;
     PatOld=patCur.Copy();
     listEmps=new ListBox();
     listEmps.Location=new Point(textEmployer.Left,textEmployer.Bottom);
     listEmps.Size=new Size(textEmployer.Width,100);
     listEmps.Visible=false;
     listEmps.Click += new System.EventHandler(listEmps_Click);
     listEmps.DoubleClick += new System.EventHandler(listEmps_DoubleClick);
     listEmps.MouseEnter += new System.EventHandler(listEmps_MouseEnter);
     listEmps.MouseLeave += new System.EventHandler(listEmps_MouseLeave);
     Controls.Add(listEmps);
     listEmps.BringToFront();
     listCounties=new ListBox();
     listCounties.Location=new Point(groupPH.Left+textCounty.Left
         ,groupPH.Top+textCounty.Bottom);
     listCounties.Size=new Size(textCounty.Width,100);
     listCounties.Visible=false;
     listCounties.Click += new System.EventHandler(listCounties_Click);
     //listCounties.DoubleClick += new System.EventHandler(listCars_DoubleClick);
     listCounties.MouseEnter += new System.EventHandler(listCounties_MouseEnter);
     listCounties.MouseLeave += new System.EventHandler(listCounties_MouseLeave);
     Controls.Add(listCounties);
     listCounties.BringToFront();
     listSites=new ListBox();
     listSites.Location=new Point(groupPH.Left+textSite.Left,groupPH.Top+textSite.Bottom);
     listSites.Size=new Size(textSite.Width,100);
     listSites.Visible=false;
     listSites.Click += new System.EventHandler(listSites_Click);
     listSites.MouseEnter += new System.EventHandler(listSites_MouseEnter);
     listSites.MouseLeave += new System.EventHandler(listSites_MouseLeave);
     Controls.Add(listSites);
     listSites.BringToFront();
     Lan.F(this);
     if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
         labelSSN.Text="SIN";
         labelZip.Text="Postal Code";
         labelST.Text="Province";
         butEditZip.Text="Edit Postal Code";
         labelCanadianEligibilityCode.Visible=true;
         comboCanadianEligibilityCode.Visible=true;
         radioStudentN.Visible=false;
         radioStudentP.Visible=false;
         radioStudentF.Visible=false;
     }
     if(CultureInfo.CurrentCulture.Name.EndsWith("GB")){//en-GB
         //labelSSN.Text="?";
         labelZip.Text="Postcode";
         labelST.Text="";//no such thing as state in GB
         butEditZip.Text="Edit Postcode";
     }
 }
开发者ID:nampn,项目名称:ODental,代码行数:56,代码来源:FormPatientEdit.cs

示例4: FormInsPlan

		//<summary>This is a field that is accessed only by clicking on the button because there's not room for it otherwise.  This variable should be treated just as if it was a visible textBox.</summary>
		//private string BenefitNotes;

		///<summary>Called from ContrFamily and FormInsPlans. Must pass in the plan, patPlan, and sub, although patPlan and sub can be null.</summary>
		public FormInsPlan(InsPlan planCur,PatPlan patPlanCur,InsSub subCur){
			Cursor=Cursors.WaitCursor;
			InitializeComponent();
			PlanCur=planCur;
			PatPlanCur=patPlanCur;
			SubCur=subCur;
			listEmps=new ListBox();
			listEmps.Location=new Point(panelPlan.Left+groupPlan.Left+textEmployer.Left,
				panelPlan.Top+groupPlan.Top+textEmployer.Bottom);
			listEmps.Size=new Size(231,100);
			listEmps.Visible=false;
			listEmps.Click += new System.EventHandler(listEmps_Click);
			listEmps.DoubleClick += new System.EventHandler(listEmps_DoubleClick);
			listEmps.MouseEnter += new System.EventHandler(listEmps_MouseEnter);
			listEmps.MouseLeave += new System.EventHandler(listEmps_MouseLeave);
			Controls.Add(listEmps);
			listEmps.BringToFront();
			listCars=new ListBox();
			listCars.Location=new Point(panelPlan.Left+groupPlan.Left+groupCarrier.Left+textCarrier.Left,
				panelPlan.Top+groupPlan.Top+groupCarrier.Top+textCarrier.Bottom);
			listCars.Size=new Size(700,100);
			listCars.HorizontalScrollbar=true;
			listCars.Visible=false;
			listCars.Click += new System.EventHandler(listCars_Click);
			listCars.DoubleClick += new System.EventHandler(listCars_DoubleClick);
			listCars.MouseEnter += new System.EventHandler(listCars_MouseEnter);
			listCars.MouseLeave += new System.EventHandler(listCars_MouseLeave);
			Controls.Add(listCars);
			listCars.BringToFront();
			//tbPercentPlan.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbPercentPlan_CellClicked);
			//tbPercentPat.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbPercentPat_CellClicked);
			Lan.F(this);
			if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
				labelPatID.Text=Lan.g(this,"Dependant Code");
				labelCitySTZip.Text=Lan.g(this,"City,Prov,Post");   //Postal Code";
				butSearch.Visible=false;
				labelElectronicID.Text="EDI Code";
				comboElectIDdescript.Visible=false;
				labelGroupNum.Text=Lan.g(this,"Plan Number");
				checkIsPMP.Checked=(planCur.CanadianPlanFlag!=null && planCur.CanadianPlanFlag!="");
			}
			else{
				labelDivisionDash.Visible=false;
				textDivisionNo.Visible=false;
				groupCanadian.Visible=false;
			}
			if(CultureInfo.CurrentCulture.Name.Length>=4 && CultureInfo.CurrentCulture.Name.Substring(3)=="GB"){//en-GB
				labelCitySTZip.Text=Lan.g(this,"City,Postcode");
			}
			panelPat.BackColor=DefC.Long[(int)DefCat.MiscColors][0].ItemColor;
			//labelViewRequestDocument.Text="         ";
			//if(!PrefC.GetBool(PrefName.CustomizedForPracticeWeb")) {
			//	butEligibility.Visible=false;
			//	labelViewRequestDocument.Visible=false;
			//}
			Cursor=Cursors.Default;
		}
开发者ID:romeroyonatan,项目名称:opendental,代码行数:61,代码来源:FormInsPlan.cs

示例5: dashboardMarketEdit

        public dashboardMarketEdit(DataTable _dataSource, Action<string, string> _UpdateSelectedMarket, LayoutPanelBase _CurrentLayout)
        {
            CurrentLayout = _CurrentLayout;
            if (null == _dataSource)
                throw new Exception ("invalid data source passed in");
            UpdateSelectedMarket = _UpdateSelectedMarket;

            MarketFilters = BuildMarketFilterBox ();

            //	NewMessage.Show ("boo");
            ListOfMarkets = new ListBox ();

            if (_dataSource.PrimaryKey.Length == 0) {
                _dataSource.PrimaryKey = new DataColumn[] { _dataSource.Columns ["Guid"] };
            }

            ViewOfTheData = new DataView (_dataSource);
            ViewOfTheData.Sort = "Caption ASC";
            ViewOfTheData.ListChanged += new System.ComponentModel.ListChangedEventHandler (OnListChanged);

            //ViewOfTheData.RowFilter = BuildRowFilter();

            ListOfMarkets.DataSource = ViewOfTheData;//_dataSource;
            ListOfMarkets.SelectedIndexChanged += HandleMarketListSelectedIndexChanged;
            ListOfMarkets.DisplayMember = "Caption";

            //ListOfMarkets.DoubleClick+= HandleListOfDoubleClick;
            //	ListOfMarkets.MouseDown+= HandleListOfMarketsMouseDown;

            //ListOfMarkets.Sorted = true;
            //ListOfMarkets.Width = 200;
            //
            // TAB CONTROL SIDE
            //

            TabControl Tabs = new TabControl ();
            Tabs.Dock = DockStyle.Fill;

            TabPage MarketEditing = new TabPage ();
            MarketEditing.Text = Loc.Instance.GetString ("Market Details");

            TabPage MarketSubmissions = new TabPage ();
            MarketSubmissions.Text = Loc.Instance.GetString ("Market Submissions");

            TabPage MarketNotes = new TabPage ();
            MarketNotes.Text = Loc.Instance.GetString ("Market Notes");

            Tabs.TabPages.Add (MarketEditing);
            Tabs.TabPages.Add (MarketNotes);
            Tabs.TabPages.Add (MarketSubmissions);

            Tabs.SelectedIndexChanged += HandleMiniTabSelectedIndexChanged;

            SubLabel = new Label ();
            SubLabel.Text = Loc.Instance.GetString ("Submissions");
            SubLabel.Dock = DockStyle.Top;
            DestLabel = new Label ();
            DestLabel.Dock = DockStyle.Bottom;
            DestLabel.Text = Loc.Instance.GetString ("Destinations");

            PreviousSubmissions = new ListBox ();
            PreviousSubmissions.DoubleClick += HandlePreviousSubmissionsDoubleClick;
            PreviousSubmissions.Dock = DockStyle.Fill;
            //PreviousSubmissions.Height = 100;

            Destinations = new ListBox ();
            Destinations.Dock = DockStyle.Bottom;
            Destinations.Height = 100;

            tmpEditor = new PropertyGrid ();
            tmpEditor.Dock = DockStyle.Fill;
            tmpEditor.PropertyValueChanged += HandlePropertyValueChanged;
            tmpEditor.Height = 300;

            MarketEditing.Controls.Add (tmpEditor);
            MarketSubmissions.Controls.Add (DestLabel);
            MarketSubmissions.Controls.Add (PreviousSubmissions);
            PreviousSubmissions.BringToFront ();

            MarketSubmissions.Controls.Add (SubLabel);
            MarketSubmissions.Controls.Add (Destinations);

            //
            // MAIN TABlE
            //

            //	Panel EasyMarketEdit = new Panel();

            //	EasyMarketEdit.BackColor = Color.Green;
            //	EasyMarketEdit.Height = 200;

            //	EasyMarketEdit.Dock = DockStyle.Fill;

            //	EasyMarketEdit.Controls.Add (Tabs);

            //	tmpEditor.Enabled = false;
            tmpEditor.BringToFront ();

            AddMarket = new Button ();
            AddMarket.Dock = DockStyle.Bottom;
//.........这里部分代码省略.........
开发者ID:BrentKnowles,项目名称:Addin_Submissions,代码行数:101,代码来源:dashboardMarketEdit.cs

示例6: _CreateListBox

        private void _CreateListBox(string filter)
        {
            if (_listBox != null)
            {
                _listBox = null;
                return;
            }
            if (!_listBoxOpened)
            {
                _listBox = new ListBox();
                //listBox.scrollDirection = 1;
                //listBox.ItemWidth = Width;
                //listBox.ItemHeight = 20;
                _listBox.FixedHeight = true;
                _listBox.Font = Font;
                _listBox.BringToFront();
                _listBox.Context = true;
                _listBox.Width = Width;
                _listBox.Height = _listBox.ItemHeight * (Items.Count > MaxDropDownItems ? MaxDropDownItems : Items.Count);
                if (_listBox.Height < _listBox.ItemHeight) _listBox.Height = _listBox.ItemHeight;
                bool selectedIndexChanged = false;
                for (int i = 0; i < Items.Count; i++)
                {
                    var item = Items[i];
                    if (DropDownStyle == ComboBoxStyle.DropDownList || String.IsNullOrEmpty(filter))
                        _listBox.Items.Add(item);
                    else
                    {
                        var itemString = item.ToString();
                        if (itemString.ToLower().Contains(filter.ToLower()))
                        {
                            _listBox.Items.Add(item);
                            if (itemString == filter)
                            {
                                _listBox.SelectedIndex = i;
                                selectedIndexChanged = true;
                            }
                        }
                    }
                }
                for (int i = 0; i < Items.Count; i++)
                    if (Items.IsDisabled(i))
                    {
                        _listBox.Items.Disable(i);
                        //Application.Log(i);
                    }
                if (selectedIndexChanged == false)
                {
                    if (SelectedIndex > -1)
                        _listBox.ScrollIndex = SelectedIndex;
                    _listBox.SelectedIndex = SelectedIndex;
                }

                var gpoint = PointToScreen(Point.Zero);
                _listBox.Location = gpoint + new Point(0, Height);
                _listBox.SelectedValueChanged += (object sender, EventArgs args) =>
                {
                    if (_listBox != null)
                    {
                        for (int i = 0; i < Items.Count; i++)
                            if (Items[i] == _listBox.SelectedItem)
                            {
                                _filter = _listBox.SelectedItem.ToString();
                                SelectedItem = _listBox.SelectedItem;
                                break;
                            }
                        //SelectedIndex = _listBox.SelectedIndex;
                        _listBox.Dispose();
                        _listBox = null;
                    }
                };
                _listBox.OnDisposing += (object sender, EventArgs args) =>
                {
                    var clientRect = new System.Drawing.Rectangle(0, 0, Width, Height);
                    var contains = clientRect.Contains(PointToClient(MousePosition));
                    if (!contains)
                        _listBoxOpened = false;
                    else
                        _listBoxOpened = !_listBoxOpened;
                    _listBox = null;
                };
            }
            else
                _listBoxOpened = false;
        }
开发者ID:Meragon,项目名称:Unity-WinForms,代码行数:85,代码来源:ComboBox.cs

示例7: registerAutoComplete

        public static ListBox registerAutoComplete(TextBox txt)
        {
            ListBox lb = new ListBox();
            lb.Width = txt.Width;
            lb.Height = txt.Height * 10;
            txt.KeyUp += dynaTxtKeys;
            txt.Leave += dynaListLeave;
            //bindData(lb, dataProvider);
            lb.KeyUp += dynaListSelected;
            lb.DoubleClick += dynaListClickSelected;
            lb.Click += dynaListClickSelected;

            lb.Name = txt.Name + AUTO_COMPLETE_NAME_PAD;
            lb.Location = new System.Drawing.Point(txt.Location.X, (txt.Location.Y+txt.Height));
            txt.Parent.Controls.Add(lb);
            lb.BringToFront();
            autoCompleteListMap.Add(txt.Name, lb);
            return lb;
        }
开发者ID:allenmathew,项目名称:chsc,代码行数:19,代码来源:UIDataFactory.cs

示例8: ViewProjectSubmissions

        public ViewProjectSubmissions(Func<string> _GetProjectGUID, getmarketbyguiddelegate _GetMarketByGUID, LayoutPanelBase _Layout)
        {
            //LastQuery = _LastQuery;

            myLayout = _Layout;
            GetProjectGUID = _GetProjectGUID;
            GetMarketByGUID = _GetMarketByGUID;

            Label Title = new Label();
            Title.Text= "List of Submissions";
            Title.Dock = DockStyle.Top;

             Overall = new Label();

            Overall.MouseEnter+= HandleMouseEnter;
            Overall.MouseLeave+= HandleMouseLeave;
            Overall.Dock = DockStyle.Top;
            Overall.Text = Loc.Instance.GetString ("OVERALL DETAILS TBD");

            ToolStrip Buttons = new ToolStrip();

            Count = new ToolStripLabel();
            Count.Text = "0";

             DeleteSelected = new ToolStripButton();
            DeleteSelected.Text = Loc.Instance.GetString ("Delete Submission");
            DeleteSelected.Click+= HandleDeleteSubmissionClick;

             GenerateCoverLetter = new ToolStripButton();
            GenerateCoverLetter.Text = Loc.Instance.GetString ("Cover Letter");
            GenerateCoverLetter.Click+= HandleGenerateCoverLetterClick;

             MakeDestination = new ToolStripButton();
            MakeDestination.Text = Loc.Instance.GetString ("Change Submission to Destination");
            MakeDestination.Click+= HandleMakeDestinationsClick;
            MakeDestination.Enabled = false;

             MakeSubmission = new ToolStripButton();
            MakeSubmission.Text = Loc.Instance.GetString ("Change Destination to Submission");
            MakeSubmission.Click+= HandleChangeDestinationToSubmissionClick;;
            MakeSubmission.Enabled = false;

            Buttons.Items.Add (Count);
            Buttons.Items.Add (DeleteSelected);
            Buttons.Items.Add (GenerateCoverLetter);
            Buttons.Items.Add (MakeDestination);
            Buttons.Items.Add (MakeSubmission);

             ListOfSubs = new ListBox();
            ListOfSubs.DoubleClick+= HandleListOfSubsDoubleClick;
            ListOfSubs.Click+= HandleListOfSubmissionsClick;
            ListOfSubs.Dock = DockStyle.Fill;
            ListOfSubs.Height = 300;

            Label DestinationsTitle = new Label();
            DestinationsTitle.Text = Loc.Instance.GetString ("Destinations");
            DestinationsTitle.Dock = DockStyle.Bottom;

            Destinations = new ListBox();
            Destinations.Dock = DockStyle.Bottom;
            Destinations.Click+= HandleDestinationsClick;

            this.Controls.Add (DestinationsTitle);
            this.Controls.Add (Destinations);

            this.Controls.Add (ListOfSubs);
            ListOfSubs.BringToFront();
            this.Controls.Add (Buttons);

            this.Controls.Add (Title);
            this.Controls.Add (Overall);
            //just add the transaction objects like workflow
            //BuildList ();
        }
开发者ID:BrentKnowles,项目名称:Addin_Submissions,代码行数:74,代码来源:ViewProjectSubmissions.cs

示例9: AutoCompleteTextBox

        public static void AutoCompleteTextBox(TextBox txtControl, ListBox lstControl, 
            List<string> lstAutoCompleteList, KeyEventArgs txtControlKEA)
        {
            Point cp;
            GetCaretPos(out cp);
            List<string> lstTemp = new List<string>();
            //Positioning the Listbox on TextBox by Type Insertion Cursor position
            lstControl.SetBounds(cp.X + txtControl.Location.X, cp.Y + txtControl.Location.Y + 20, 150, 50);

            var TempFilteredList = lstAutoCompleteList.Where
                (n => n.StartsWith(GetLastString(txtControl.Text))).Select(r => r);

            lstTemp = TempFilteredList.ToList<string>();
            if (lstTemp.Count != 0 && GetLastString(txtControl.Text) != "")
            {
                lstControl.DataSource = lstTemp;
                lstControl.Show();
                lstControl.BringToFront();
            }
            else
            {
                lstControl.Hide();
            }

            //Code for focusing ListBox Items While Pressing Down and UP Key.
            if (txtControlKEA.KeyCode == Keys.Down)
            {
                lstControl.SelectedIndex = 0;
                lstControl.Focus();
                txtControlKEA.Handled = true;
            }
            else if (txtControlKEA.KeyCode == Keys.Up)
            {
                lstControl.SelectedIndex = lstControl.Items.Count - 1;
                lstControl.Focus();
                txtControlKEA.Handled = true;
            }

            //text box key press event
            txtControl.KeyPress += (s, kpeArgs) =>
            {

                if (kpeArgs.KeyChar == (char)Keys.Enter)
                {
                    if (lstControl.Visible)
                    {
                        lstControl.Focus();
                    }
                    kpeArgs.Handled = true;
                }
                else if (kpeArgs.KeyChar == (char)Keys.Escape)
                {
                    lstControl.Visible = false;
                    kpeArgs.Handled = true;
                }
                else if (kpeArgs.KeyChar == (char)Keys.Tab)
                {
                    txtControl.Text = ((ListBox)s).SelectedItem.ToString();
                    txtControl.Select(txtControl.Text.Length, 0);
                    txtControl.Focus();
                    lstControl.Hide();
                }
            };

            txtControl.LostFocus += (s, eventArgs) =>
                {
                    if (!lstControl.Focused)
                        lstControl.Hide();
                };

            //listbox keyup event
            lstControl.KeyUp += (s, kueArgs) =>
            {
                if (kueArgs.KeyCode == Keys.Tab)
                {
                    //string StrLS = GetLastString(txtControl.Text);
                    //int LIOLS = txtControl.Text.LastIndexOf(StrLS);
                    //string TempStr = txtControl.Text.Remove(LIOLS);
                    //txtControl.Text = TempStr + ((ListBox)s).SelectedItem.ToString();
                    txtControl.Text = ((ListBox)s).SelectedItem.ToString();
                    txtControl.Select(txtControl.Text.Length, 0);
                    txtControl.Focus();
                    lstControl.Hide();
                }
                else if (kueArgs.KeyCode == Keys.Escape)
                {
                    lstControl.Hide();
                    txtControl.Focus();
                }
            };
        }
开发者ID:Sadikk,项目名称:BlueSheep,代码行数:91,代码来源:IntelliSense.cs

示例10: DoBuildChildren

        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren (Layout);
            CaptionLabel.Dock = DockStyle.Top;

            mode = new ComboBox ();
            mode.Parent = ParentNotePanel;
            mode.DropDownStyle = ComboBoxStyle.DropDownList;
            mode.Dock = DockStyle.Top;
            mode.BringToFront ();

            mode.Items.Add (Loc.Instance.GetString ("Notes on This Layout"));
            mode.Items.Add (Loc.Instance.GetString ("All Layouts"));
            mode.Items.Add (Loc.Instance.GetString ("Notes on Current Layout"));

            mode.SelectedIndexChanged += HandleDropDownSelectedIndexChanged;

            SearchDetails = new Panel ();

            AdjustDockingOfSearchPanel();

            CurrentFilterDropDown = new ComboBox ();
            CurrentFilterDropDown.Dock = DockStyle.Bottom;

            // because we need the tables to be loaded we CANNOT load this data now
            LayoutDetails.Instance.UpdateAfterLoadList.Add (this);

            TextEditor = new ComboBox ();
            TextEditor.Dock = DockStyle.Bottom;
            TextEditor.KeyPress += HandleTextEditKeyPress;
            TextEditor.KeyUp += HandleKeyUp;

            // Do some cleanup on history item to keep the list reasonable.
            // This happens only on load to keep things simple
            if (History.Count > 10) {
                History.RemoveRange(9, (History.Count)-9);
            }

            foreach (string s in History) {
                TextEditor.Items.Add (s);
            }

            TextEditor.SelectedIndexChanged+= (object sender, EventArgs e) => 	Refresh ();;

            FullTextSearch = new CheckBox();
            FullTextSearch.Checked = false;
            FullTextSearch.Text = Loc.Instance.GetString ("Search All Text Fields");
            FullTextSearch.Dock = DockStyle.Bottom;

            SearchDetails.Controls.Add (TextEditor);
            SearchDetails.Controls.Add (CurrentFilterDropDown);
            SearchDetails.Controls.Add (FullTextSearch);

            list = new ListBox();
            //list.SelectedIndexChanged += HandleDropDownSelectedIndexChanged;
            list.Parent = ParentNotePanel;
            list.Width = 125;
            list.Dock = DockStyle.Fill;
            list.BringToFront();
            list.BindingContextChanged+= HandleBindingContextChanged;
            list.DoubleClick += HandleListBoxDoubleClick;
            list.Click+= HandleNoteListClick;

            ParentNotePanel.Controls.Add (SearchDetails);

            count = new Label();
            count.Parent = ParentNotePanel;
            count.Dock = DockStyle.Bottom;

            blurb = new Label();
            blurb.Parent = ParentNotePanel;
            blurb.Dock = DockStyle.Bottom;

            refresh = new Button();
            refresh.Text = Loc.Instance.GetString("Refresh");
            refresh.Dock = DockStyle.Bottom;
            refresh.Parent = ParentNotePanel;
            refresh.Click += HandleRefreshClick;

            //Menu Stuff

             TokenItem = new ToolStripMenuItem(Loc.Instance.GetString("Dock on Bottom?"));
            TokenItem.CheckOnClick = true;
            TokenItem.Click += (object sender, EventArgs e) => {
                searchDetailsDock = (sender as ToolStripMenuItem).Checked;
                AdjustDockingOfSearchPanel();
                this.SetSaveRequired(true);
            };
            if (searchDetailsDock) TokenItem.Checked = true; else TokenItem.Checked= false;

            properties.DropDownItems.Add (new ToolStripSeparator());
            properties.DropDownItems.Add (TokenItem);

            //	AdjustHeightOfLayoutSearchPanel (); This already gets called when the note type is chosen
        }
开发者ID:BrentKnowles,项目名称:YourOtherMind,代码行数:95,代码来源:NoteDataXML_NoteList.cs


注:本文中的System.Windows.Forms.ListBox.BringToFront方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。