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


C# ListBox.Show方法代码示例

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


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

示例1: MapEntPropertiesView

        public MapEntPropertiesView(Editor e)
            : base()
        {
            editor = e;
            engine = e.engine;

            Text = "MapEnt properties";

            enttypes = new ListBox();
            enttypes.Location = new System.Drawing.Point(10, 10);
            enttypes.Items.Clear();
            foreach (string s in MapEnt.enttypes)
                enttypes.Items.Add(s);
            enttypes.Show();

            Controls.Add(enttypes);

            entprops = new TextBox[5];
            int x = 10;
            int y = enttypes.Bottom + 5;

            for (int i = 0; i < numprops; i++) {
                entprops[i] = new TextBox();
                entprops[i].Location = new System.Drawing.Point(x, y);
                entprops[i].Show();
                Controls.Add(entprops[i]);
                y = entprops[i].Bottom + 5;
            }
        }
开发者ID:kg,项目名称:XnaMannux,代码行数:29,代码来源:MapEntPropertiesView.cs

示例2: CompletionToolTipWindow

            public CompletionToolTipWindow(ListBox completions)
            {
                _completions = completions;

                FormBorderStyle = FormBorderStyle.None;
                StartPosition = FormStartPosition.Manual;
                TopMost = true;
                ShowInTaskbar = false;
                Opacity = 0.9;

                Controls.Add(completions);

                Width = Math.Max(completions.PreferredSize.Width, 150);
                Height = Math.Min(completions.PreferredHeight, 100);
                completions.Height = Height;
                completions.Width = Width;

                completions.Show();
            }
开发者ID:pterelaos,项目名称:revitpythonshell,代码行数:19,代码来源:CompletionToolTip.cs

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

示例4: AgentGUI

        public AgentGUI( string caption )
        {
            m_Id = ++m_IdCounter;
            RadioGroupUpdater[] tmpOld = m_UpdaterList;
            m_UpdaterList = new RadioGroupUpdater[m_Id];
            if ( tmpOld != null )
                for ( int i = 0; i < tmpOld.Length; i++ )
                    m_UpdaterList[i] = tmpOld[i];
            m_UpdaterList[m_Id-1] = new RadioGroupUpdater( SyncPlayerSelectors );

            this.Text = caption;
            this.Width = 430;
            this.Height = 340;
            this.MaximizeBox = false;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            m_GroupBoxPlayer = new GroupBox();
            m_GroupBoxPlayer.Text = "Play as";
            m_GroupBoxPlayer.Width = 100;
            m_GroupBoxPlayer.Height = 150;
            m_GroupBoxPlayer.Left = 10;
            m_GroupBoxPlayer.Top = 25;
            m_GroupBoxPlayer.Show();
            this.Controls.Add( m_GroupBoxPlayer );

            m_PlayerLight = new RadioButton();
            m_PlayerLight.Text = "Light";
            m_PlayerLight.Width = 50;
            m_PlayerLight.Left = 25;
            m_PlayerLight.Top = 50;
            m_PlayerLight.Checked = true;
            m_PlayerLight.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerLight.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerLight );

            m_PlayerDark = new RadioButton();
            m_PlayerDark.Text = "Dark";
            m_PlayerDark.Width = 50;
            m_PlayerDark.Left = 25;
            m_PlayerDark.Top = 80;
            m_PlayerDark.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerDark.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerDark );

            m_PlayerNone = new RadioButton();
            m_PlayerNone.Text = "None";
            m_PlayerNone.Width = 50;
            m_PlayerNone.Left = 25;
            m_PlayerNone.Top = 20;
            m_PlayerNone.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerNone.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerNone );

            m_PlayerBoth = new RadioButton();
            m_PlayerBoth.Text = "Both";
            m_PlayerBoth.Width = 50;
            m_PlayerBoth.Left = 25;
            m_PlayerBoth.Top = 110;
            m_PlayerBoth.CheckedChanged += new EventHandler( m_PlayerSelect_Click );
            m_PlayerBoth.Show();
            m_GroupBoxPlayer.Controls.Add( m_PlayerBoth );

            m_EvaluatorLabel = new Label();
            m_EvaluatorLabel.Text = "Evaluator";
            m_EvaluatorLabel.Left = 10;
            m_EvaluatorLabel.Top = 190;
            m_EvaluatorLabel.AutoSize = true;
            m_EvaluatorLabel.Show();
            this.Controls.Add( m_EvaluatorLabel );

            m_PluginSelector = new ComboBox();
            m_PluginSelector.DropDownStyle = ComboBoxStyle.DropDownList;
            m_PluginSelector.Left = 10;
            m_PluginSelector.Top = 210;
            m_PluginSelector.Width = 100;
            m_PluginSelector.Items.Add( "None" );
            m_PluginSelector.SelectedIndex = 0;
            m_PluginSelector.Show();
            this.Controls.Add( m_PluginSelector );

            m_LearnPanel = new Panel();
            m_LearnPanel.BorderStyle = BorderStyle.None;
            m_LearnPanel.Left = 5;
            m_LearnPanel.Top = 240;
            m_LearnPanel.Width = 100;
            m_LearnPanel.Height = 25;
            m_LearnPanel.Show();
            this.Controls.Add( m_LearnPanel );

            m_Learn = new CheckBox();
            m_Learn.Text = "Learn";
            m_Learn.Left = 5;
            m_Learn.Top = 0;
            m_Learn.Checked = false;
            m_Learn.CheckedChanged += new EventHandler( m_Learn_CheckedChanged );
            m_Learn.Show();
            m_LearnPanel.Controls.Add( m_Learn );
            if (m_Id == 1)
                m_Learn.Checked = true;

//.........这里部分代码省略.........
开发者ID:prezz,项目名称:Fuzzy-Gammon,代码行数:101,代码来源:AgentGUI.cs

示例5: CompletionToolTipWindow

            public CompletionToolTipWindow(ListBox completions,TextBox documentation)
            {
                _completions = completions;
                _documentation = documentation;

                FormBorderStyle = FormBorderStyle.None;
                StartPosition = FormStartPosition.Manual;
                TopMost = true;
                ShowInTaskbar = false;
                BackColor = Color.White;
                Opacity = 0.9;

                Controls.Add(completions);
                Controls.Add(documentation);

                Width = completions.PreferredSize.Width;
                Height = completions.Height + documentation.Height;
                completions.Width = Width;
                documentation.Width = Width;
                documentation.Location = new Point(completions.Location.X,completions.Location.Y + completions.Height);

                completions.Show();
                documentation.Show();
            }
开发者ID:JGalvezTT,项目名称:revitpythonshell,代码行数:24,代码来源:CompletionToolTip.cs


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