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


C# ComboBox.BringToFront方法代码示例

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


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

示例1: ShowCombobox

        /// <summary>
        /// 
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="lst"></param>
        /// <param name="x">鼠标的x坐标</param>
        /// <param name="y">鼠标的y坐标</param>
        /// <param name="col">ComboBox显示在哪个列上</param>
        /// <param name="defaultValueCol">ComboBox的默认值列</param>
        private static void ShowCombobox(ListView lv, ComboBox lst, int x, int y, int col, int defaultValueCol)
        {
            var item = lv.GetItemAt(x, y);
            if (item == null || !item.Checked)
                return;
            comboboxItem = item;

            int lWidth = 0, rWidth = 0;
            for (int i = 0; i <= col; i++)
            {
                int tmp = lv.Columns[i].Width;
                if (i < col)
                    lWidth += tmp;
                rWidth += tmp;
            }

            if (x > rWidth || x < lWidth)
            {
                lst.Visible = false;
                return;
            }

            //获取所在位置的行的Bounds            
            Rectangle rect = item.Bounds;
            //修改Rect的范围使其与第二列的单元格的大小相同,为了好看 ,左边缩进了2个单位                       
            rect.X += lv.Left + lWidth + 2;
            rect.Y += lv.Top + 2;
            rect.Width = rWidth - lWidth;
            lst.Bounds = rect;
            string val = item.SubItems[col].Text;
            if (string.IsNullOrEmpty(val) && defaultValueCol >= 0 && item.SubItems.Count > defaultValueCol)
                val = item.SubItems[defaultValueCol].Text;
            lst.Text = val;
            lst.Visible = true;
            lst.BringToFront();
            lst.Focus();
            lst.Name = col.ToString();

            //lst.SelectedIndexChanged -= lstSelectedIndexChanged;// (obj, args) => { MessageBox.Show("1"); };
        }
开发者ID:bincle,项目名称:Beinet.cn.Tools,代码行数:49,代码来源:MainForm.cs

示例2: CreateManualFileEntryControl

        private void CreateManualFileEntryControl(object sender, EventArgs e)
        {
            if (_fileCombo != null &&_fileCombo.Visible)
            {
                _fileCombo.Visible = false;
                Controls.Remove(_fileCombo);
                return;
            }

            string currentDirectory;
            if (BreadCrumbTrail.Items.Count > 2)
                currentDirectory = (string)BreadCrumbTrail.Items[BreadCrumbTrail.Items.Count - 1].Tag;
            else if (_overflowStack.Any())
                currentDirectory = (string) _overflowStack.Peek().Tag;
            else
                currentDirectory = string.Empty;

            _fileCombo = new ComboBox
                                {
                                    Text = currentDirectory,
                                    Anchor =
                                        AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                                    Width = BreadCrumbTrail.Width - BreadCrumbTrail.Items[0].Width + HistoryButton.Width-1,
                                    Location = new Point(BreadCrumbTrail.Items[0].Width,0),
                                    FlatStyle = FlatStyle.Flat,
                                    AutoCompleteMode = AutoCompleteMode.SuggestAppend,
                                    AutoCompleteSource = AutoCompleteSource.FileSystemDirectories
                                };
            _fileCombo.Items.Add(currentDirectory);
            var history = FolderHistoryInterface.GetRecentFolders();
            foreach (var item in history.Where(item => !string.IsNullOrEmpty(item) && item != currentDirectory))
                _fileCombo.Items.Add(item);

            _fileCombo.KeyDown += (x, y) =>
                                      {
                                          if (y.KeyCode == Keys.Return)
                                          {
                                              y.Handled = true;
                                              if (Directory.Exists(_fileCombo.Text))
                                              {
                                                  _fileCombo.Visible = false;
                                                  Controls.Remove(_fileCombo);
                                                  Navigate(_fileCombo.Text.TrimEnd('\\'), null);
                                              }
                                              else
                                                  MessageBox.Show("Directory does not exist");
                                          }
                                          else if (y.KeyCode == Keys.Escape)
                                          {
                                              _fileCombo.Visible = false;
                                              Controls.Remove(_fileCombo);
                                              return;
                                          }
                                      };

            Controls.Add(_fileCombo);
            _fileCombo.Select();
            _fileCombo.SelectionStart = _fileCombo.Text.Length;

            if (sender == HistoryButton)
                _fileCombo.DroppedDown = true;
            _fileCombo.BringToFront();
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:63,代码来源:BreadCrumbControl.cs

示例3: InitUI

        /// <summary>
        /// Creates and initializes UI.
        /// </summary>
        private void InitUI()
        {
            this.ClientSize = new Size(400,450);
            this.Text = "RTP debug";
            //this.Icon = ; TODO:
            this.FormClosing += new FormClosingEventHandler(wfrm_RTP_Debug_FormClosing);

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

            m_pTab.TabPages.Add("participants","Participants");

            m_pParticipantsSplitter = new SplitContainer();
            m_pParticipantsSplitter.Dock = DockStyle.Fill;
            m_pParticipantsSplitter.Orientation = Orientation.Vertical;
            m_pParticipantsSplitter.SplitterDistance = 60;
            m_pTab.TabPages["participants"].Controls.Add(m_pParticipantsSplitter);

            m_pParticipants = new TreeView();
            m_pParticipants.Dock = DockStyle.Fill;
            m_pParticipants.BorderStyle = BorderStyle.None;
            m_pParticipants.FullRowSelect = true;
            m_pParticipants.HideSelection = false;
            m_pParticipants.AfterSelect += new TreeViewEventHandler(m_pParticipants_AfterSelect);
            m_pParticipantsSplitter.Panel1.Controls.Add(m_pParticipants);

            m_pParticipantData = new PropertyGrid();
            m_pParticipantData.Dock = DockStyle.Fill;
            m_pParticipantsSplitter.Panel2.Controls.Add(m_pParticipantData);

            m_pTab.TabPages.Add("global_statistics","Global statistics");

            m_pGlobalSessionInfo = new PropertyGrid();
            m_pGlobalSessionInfo.Dock = DockStyle.Fill;
            m_pTab.TabPages["global_statistics"].Controls.Add(m_pGlobalSessionInfo);

            m_pSessions = new ComboBox();
            m_pSessions.Size = new Size(200,20);
            m_pSessions.Location = new Point(100,2);
            m_pSessions.DropDownStyle = ComboBoxStyle.DropDownList;
            m_pSessions.SelectedIndexChanged += new EventHandler(m_pSessions_SelectedIndexChanged);
            m_pTab.TabPages["global_statistics"].Controls.Add(m_pSessions);
            m_pSessions.BringToFront();

            m_pTab.TabPages.Add("errors","Errors");

            m_pErrors = new ListView();
            m_pErrors.Dock = DockStyle.Fill;
            m_pErrors.View = View.Details;
            m_pErrors.FullRowSelect = true;
            m_pErrors.HideSelection = false;
            m_pErrors.Columns.Add("Message",300);
            m_pErrors.DoubleClick += new EventHandler(m_pErrors_DoubleClick);
            m_pTab.TabPages["errors"].Controls.Add(m_pErrors);

            this.Controls.Add(m_pTab);
        }
开发者ID:salih18200,项目名称:orcs,代码行数:60,代码来源:wfrm_RTP_Debug.cs

示例4: AddMaleApparels

        //Adding all male apparels information into their respective category(tabPage)
        private void AddMaleApparels()
        {
            foreach (TabPage tp in MCatalogue.TabPages)
            {
                tp.BackColor = Color.White;

                FlowLayoutPanel flp = new FlowLayoutPanel();
                flp.Dock = DockStyle.Fill;
                flp.AutoScroll = true;
                flp.VerticalScroll.Visible = true;
                flp.BackColor = Color.White;

                foreach (Apparel apparel in store.Apparels)
                {
                    if (apparel.Gender == 'M' && MCatalogue.TabPages.IndexOf(tp) == (apparel.Category.CategoryID - 1))
                    {
                        //Panel for each product
                        Panel panel = new Panel();
                        panel.Size = new Size(170, 270);
                        panel.BackColor = Color.White;
                        panel.BorderStyle = BorderStyle.FixedSingle;

                        //PictureBox for each product's image
                        PictureBox pb = new PictureBox();
                        pb.Location = new Point(9, 0);
                        pb.Size = new Size(150, 150);
                        pb.ImageLocation = "images/" + apparel.ImagePath;
                        pb.SizeMode = PictureBoxSizeMode.StretchImage;

                        //Label for the product's Description
                        Label productDescriptionLabel = new Label();
                        productDescriptionLabel.Location = new Point(0, 140);
                        productDescriptionLabel.Size = new Size(170, 40);
                        productDescriptionLabel.BackColor = Color.Transparent;
                        productDescriptionLabel.Text = apparel.Description;
                        productDescriptionLabel.TextAlign = ContentAlignment.MiddleLeft;
                        productDescriptionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                        //Label for the product's price
                        Label priceLabel = new Label();
                        priceLabel.Location = new Point(0, 180);
                        priceLabel.Size = new Size(170, 22);
                        priceLabel.BackColor = Color.Transparent;
                        productDescriptionLabel.TextAlign = ContentAlignment.MiddleLeft;
                        priceLabel.Text = "Price: " + apparel.Price.ToString("C", CultureInfo.CreateSpecificCulture("en-US"));
                        priceLabel.Font = new System.Drawing.Font("Arial", 8.4F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                        //Label to display text "Size: "
                        Label sizeLabel = new Label();
                        sizeLabel.Location = new Point(0, 207);
                        sizeLabel.Size = new Size(41, 16);
                        sizeLabel.BackColor = Color.Transparent;
                        sizeLabel.Text = "Size:";
                        sizeLabel.Font = new System.Drawing.Font("Arial", 8.4F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        sizeLabel.SendToBack();

                        //ComboxBox for user to select the size of the apparel
                        ComboBox sizeSelector = new ComboBox();
                        sizeSelector.Location = new Point(41, 205);
                        sizeSelector.Size = new Size(50, 80);
                        sizeSelector.Text = "size";
                        string[] possibleSize = { "XS", "S", "M", "L", "XL" };
                        foreach (string size in possibleSize)
                        {
                            sizeSelector.Items.Add(size);
                        }
                        sizeSelector.SelectedValueChanged += UpdateProductSize;
                        sizeSelector.Tag = apparel;
                        sizeSelector.BringToFront();

                        //Label to display the text "Quantity: "
                        Label quantityLabel = new Label();
                        quantityLabel.Location = new Point(90, 207);
                        quantityLabel.Size = new Size(35, 16);
                        quantityLabel.BackColor = Color.Transparent;
                        quantityLabel.Text = "Qty:";
                        quantityLabel.Font = new System.Drawing.Font("Arial", 8.4F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        quantityLabel.SendToBack();

                        //NumericUpDown for user to select the quantity of the apparel
                        NumericUpDown quantitySelector = new NumericUpDown();
                        quantitySelector.Location = new Point(125, 205);
                        quantitySelector.Size = new Size(40, 30);
                        quantitySelector.TextAlign = HorizontalAlignment.Right;
                        quantitySelector.ReadOnly = true;
                        quantitySelector.Maximum = 5;
                        quantitySelector.Minimum = 0;
                        quantitySelector.ValueChanged += UpdateProductQuantity;
                        quantitySelector.Tag = apparel;
                        quantitySelector.BringToFront();

                        //Button for adding the product into the cart
                        Button b = new Button();
                        b.Location = new Point(19, 235);
                        b.Size = new Size(130, 30);
                        b.BackColor = System.Drawing.Color.Transparent;
                        b.FlatStyle = FlatStyle.Flat;
                        b.FlatAppearance.BorderColor = Color.Black;
                        b.FlatAppearance.BorderSize = 2;
//.........这里部分代码省略.........
开发者ID:alamsah2,项目名称:Prototype_Alam,代码行数:101,代码来源:POS.cs

示例5: FormDownloads

        public FormDownloads()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            Initialize();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            try
            {
                this.tabControlFilter.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiBox;
                this.tabControlDetails.Appearance = Crownwood.Magic.Controls.TabControl.VisualAppearance.MultiBox;
                this.tabControlDetails.PositionTop = true;
                eLePhantButton1_Click(this,null);

                m_selectedTabControlDetails = 0;

                this.contextMenuFilter.Popup+=new EventHandler(contextMenuFilter_Popup);
                menuItemShowCount.Click+=new EventHandler(menuItemShowCount_Click);
                menuItemShowTotalSizes.Click+=new EventHandler(menuItemShowTotalSizes_Click);
                menuItemAutoSort.Click+=new EventHandler(menuItemAutoSort_Click);
                this.downloadList.ContextMenuDownloads.MenuItems[13].Click+=new EventHandler(downloadList_DoubleClick);
                m_DetailsSize=0;

                //if view categories in a listBox
                comboBoxCategories=new ComboBox();
                this.panel7.Controls.Add(this.comboBoxCategories);

                //comboBoxCategories.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                comboBoxCategories.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));

                comboBoxCategories.DropDownStyle=ComboBoxStyle.DropDownList;
                comboBoxCategories.Size = new System.Drawing.Size(100, 21);
                //comboBoxCategories.Location = new System.Drawing.Point(buttonAddeLink.Left-5-comboBoxCategories.Width, 2);
                comboBoxCategories.Location = new System.Drawing.Point(this.label1.Right+5, 2);
                this.tabControlFilter.Left+=comboBoxCategories.Width;
                comboBoxCategories.Name = "comboBoxCategories";
                comboBoxCategories.TabIndex =4;
                comboBoxCategories.BringToFront();
                tabControlFilter.Width-=comboBoxCategories.Width+5;
                comboBoxCategories.SelectedIndexChanged += new System.EventHandler(comboBoxCategories_SelectedIndexChanged);
                comboBoxCategories.ContextMenu=contextMenuFilter;
                label1.ContextMenu=contextMenuFilter;
                //end if
                contextMenuFilter.MenuItems.Add("-");
                manageCategories=new MenuItem("Manage categories...");
                manageCategories.Click+=new EventHandler(manageCategories_Click);
                contextMenuFilter.MenuItems.Add(manageCategories);

                m_Globalize();
            }
            catch(Exception e)
            {
                Debug.WriteLine(e.ToString());
            }
        }
开发者ID:sonicwang1989,项目名称:lphant,代码行数:59,代码来源:FormDownloads.cs

示例6: InitializeBinding

        public override void InitializeBinding(MapObjectHolder target)
        {
            this.target = target;

            if (target.GetParent().GetParent().GetType() != typeof(layerObj))
            {
                this.Enabled = false;
                return;
            }

            layerObj layer = target.GetParent().GetParent();
            styleObj style = target;
            if (itemList == null)
            {
                itemList = new ComboBox();
                itemList.Width = targetControl.Width;
                itemList.Height = targetControl.Height;
                itemList.Location = targetControl.Location;
                itemList.DropDownStyle = ComboBoxStyle.DropDownList;
                itemList.SelectedIndexChanged += new EventHandler(itemList_SelectedIndexChanged);
                targetControl.Parent.Controls.Add(itemList);
                itemList.BringToFront();
                Bitmap bmp = Resources.DataConnection;
                bmp.MakeTransparent(Color.Magenta);
                pbox = new PictureBox();
                pbox.Image = bmp;
                pbox.SizeMode = PictureBoxSizeMode.AutoSize;
                pbox.Location = new System.Drawing.Point(targetControl.Location.X + targetControl.Width + 2,
                    targetControl.Location.Y + (targetControl.Height - pbox.Image.Height) / 2);
                targetControl.Parent.Controls.Add(pbox);
                pbox.BringToFront();
            }

            BindingState = false;

            itemList.Items.Clear();
            layer.open();
            for (int i = 0; i < layer.numitems; i++)
                itemList.Items.Add(layer.getItem(i));
            if (layer.getResults() == null)
                layer.close(); // close only is no query results

            if (layer.connectiontype == MS_CONNECTION_TYPE.MS_OGR)
            {
                itemList.Items.Add("OGR:LabelFont");
                itemList.Items.Add("OGR:LabelSize");
                itemList.Items.Add("OGR:LabelText");
                itemList.Items.Add("OGR:LabelAngle");
                itemList.Items.Add("OGR:LabelFColor");
                itemList.Items.Add("OGR:LabelBColor");
                itemList.Items.Add("OGR:LabelPlacement");
                itemList.Items.Add("OGR:LabelAnchor");
                itemList.Items.Add("OGR:LabelDx");
                itemList.Items.Add("OGR:LabelDy");
                itemList.Items.Add("OGR:LabelPerp");
                itemList.Items.Add("OGR:LabelBold");
                itemList.Items.Add("OGR:LabelItalic");
                itemList.Items.Add("OGR:LabelUnderline");
                itemList.Items.Add("OGR:LabelPriority");
                itemList.Items.Add("OGR:LabelStrikeout");
                itemList.Items.Add("OGR:LabelStretch");
                itemList.Items.Add("OGR:LabelAdjHor");
                itemList.Items.Add("OGR:LabelAdjVert");
                itemList.Items.Add("OGR:LabelHColor");
                itemList.Items.Add("OGR:LabelOColor");
            }

            string binding = style.getBinding((int)styleBinding);
            if (binding != null)
            {
                itemList.SelectedItem = binding;
                BindingState = true;
            }
            else
            {
                if (itemList.Items.Count > 0)
                    itemList.SelectedIndex = 0;
            }
        }
开发者ID:4g0st1n0,项目名称:MapManager,代码行数:79,代码来源:BindingController.cs

示例7: SearchDgv_Click

        /// <summary>
        /// 单击查询窗体datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchDgv_Click(object sender, EventArgs e)
        {
            //string sqlstatus = "SELECT NAME FROM SPFLOWSTATUS_TAB where id not in (6,8,9,15) ORDER BY ID";
            string sqlstatus = "SELECT NAME FROM SP_FLOWSTATUS_TAB  ORDER BY ID";
            if (table_name == "SP_SPOOL_TAB" || table_name == "FLOWLOG_VIEW")
            {
                ComboBox cb = new ComboBox();
                foreach( DataGridViewRow dr in this.SearchDgv.Rows )
                {
                    if(dr.Cells[4].Selected == true)
                    {
                        int id = dr.Index;
                        if(dr.Cells[0].Value.ToString() == "FLOWSTATUS")
                        {
                             Rectangle rec = this.SearchDgv.GetCellDisplayRectangle(4, id, true);
                            cb.SetBounds(rec.Location.X, rec.Location.Y, rec.Width, rec.Height);
                            this.SearchDgv.Controls.Add(cb);
                            cb.Items.Add(string.Empty);
                            DetailInfo.Application_Code.FillComboBox.GetFlowStatus(cb,sqlstatus);
                            cb.BringToFront();
                            cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
                        }
                        else
                        {
                            foreach (Control combo in this.SearchDgv.Controls)
                            {
                                if (combo is ComboBox)
                                {
                                    combo.Dispose();
                                }
                            }
                        }
                    }
                }

            }
        }
开发者ID:freudshow,项目名称:raffles-codes,代码行数:42,代码来源:SearchForm.cs

示例8: 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

示例9: AddMidpoint

        private void AddMidpoint(SolarSystem systemToAdd)
        {
            //Get a count of all the ComboBox's in the panel
            int controlCount = 0;
            foreach (Control cont in pnlMidpoints.Controls)
                if (cont.GetType() == typeof(ComboBox))
                    controlCount++;

            //Configure the textbox to be similar to the start / end desto properties
            ComboBox newTextBox = new ComboBox();
            pnlMidpoints.Controls.Add(newTextBox);

            newTextBox.ValueMember = "SolarSystemID";
            newTextBox.DisplayMember = "SolarSystemName";
            newTextBox.DropDownStyle = ComboBoxStyle.Simple;
            newTextBox.Tag = controlCount + 1;

            if (systemToAdd.SolarSystemName != null)
            {
                //If the system parsed is a legit system, set the combo box's text and selected item to the parsed system
                newTextBox.Text = systemToAdd.SolarSystemName;
                newTextBox.Items.Add(systemToAdd);
                newTextBox.SelectedItem = systemToAdd;
            }

            //We dont store each individual solar system, so when they select an item from the dropdown, just close it backup.
            newTextBox.SelectedIndexChanged += (object o, EventArgs e) =>
            {
                newTextBox.Size = new Size(newTextBox.Size.Width, 23);
            };

            //When the textbox text is updated, behave EXACTLY like the static start / desto boxes
            newTextBox.TextUpdate += (object o, EventArgs e) =>
            {
                newTextBox.Items.Clear();
                //Get the containers current sizes
                Size contSize = newTextBox.Size;
                string userText = newTextBox.Text;
                //If the user has entered 3 or more chars, lets do a lookup. If its less... Ignore it, we dont want to search this vague
                if (userText.Length >= 3)
                {
                    //Get all systems that are similar to the entered values
                    IEnumerable<SolarSystem> systems = _dataRepository.GetSolarSystemsLikeName(userText);
                    if (systems.Count() > 0)
                    {
                        newTextBox.Items.AddRange(systems.ToArray());
                        //New items were added, so we want to display the drop down so they can select one. They MUST select one.
                        newTextBox.DropDownStyle = ComboBoxStyle.Simple;
                        //Height of the drop down is either 121 if the list height exceedes 121, with a height of 21 for each item. If less, the drop down is equal to minimum height for the items.
                        int height = ((systems.Count() * 21) > 100) ? 121 : ((systems.Count() * 21) + 21);
                        //Re-size the combo back to standard if less than 3 values entered. This is because they might exceed 3, then backspace.
                        newTextBox.Size = new Size(contSize.Width, height);
                        newTextBox.BringToFront();
                    }
                    else
                        //If there are no systems, hide the drop down (Even if its not shown)
                        newTextBox.Size = new Size(contSize.Width, 21);
                }
                else
                {
                    //If there are no systems, hide the drop down (Even if its not shown)
                    newTextBox.Size = new Size(contSize.Width, 21);
                }
                //Highlight the whole combobox, and put the cursor at the end
                newTextBox.Select(newTextBox.Text.Length, 0);
                //Bring the dropdown to the front so nothing obstructs it.
                newTextBox.BringToFront();
            };
            newTextBox.Size = new Size(140, 21);
            //Calcualate the next logical position based on the existing controls. 10 padding
            if (controlCount > 0)
                newTextBox.Location = new Point(10, ((controlCount * 21) + controlCount * 9) + 9);
            else
                newTextBox.Location = new Point(10, 9);
        }
开发者ID:reecebedding,项目名称:EVE_LogisticiansTool,代码行数:75,代码来源:RoutePlanner.cs


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