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


C# ComboBox.GetType方法代码示例

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


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

示例1: setVarBoxesInPanel

        public void setVarBoxesInPanel()
        {
            panelVariableControls.Controls.Clear();
            int locationX = dataViewer.RowHeadersWidth;
            int colNum = 0;
            int j = 0; ;
            for (int i = 1; i < dataViewer.Columns.Count; i++)
            {
                j++;
                int defaultWidth = dataViewer.Columns[colNum].Width;
                int defaultHeight = 21;
                int currentYLoc = 0;
                //Main comboBox
                string comboboxName = i + "ComboMain";
                ComboBox newCombo = new ComboBox();
                newCombo.Name = comboboxName;
                newCombo.Width = defaultWidth;
                newCombo.Height = defaultHeight;
                newCombo.Location = new Point(locationX, currentYLoc);
                currentYLoc += defaultHeight;
                newCombo.Items.Add("Variable");
                newCombo.Items.Add("DateTime");
                newCombo.Items.Add("Date");
                newCombo.Items.Add("Time");
                panelVariableControls.Controls.Add(newCombo);
                EventInfo comboMainChanged = newCombo.GetType().GetEvent("TextChanged");
                comboMainChanged.AddEventHandler(newCombo, new EventHandler(this.comboMainChanged));
                comboBoxes.Add(newCombo);

                //Secondary comboBox (Variable Name/DateTime format)
                comboboxName = i + "Combo2";
                ComboBox newCombo2 = new ComboBox();
                newCombo2.Name = comboboxName;
                newCombo2.Width = defaultWidth;
                newCombo2.Height = defaultHeight;
                newCombo2.Enabled = false;
                newCombo2.Location = new Point(locationX, currentYLoc);
                currentYLoc += defaultHeight;
                panelVariableControls.Controls.Add(newCombo2);
                EventInfo combo2Changed = newCombo2.GetType().GetEvent("TextChanged");
                combo2Changed.AddEventHandler(newCombo2, new EventHandler(this.combo2Changed));
                newCombo2.AutoCompleteMode = AutoCompleteMode.Append;
                newCombo2.AutoCompleteSource = AutoCompleteSource.ListItems;

                //3rd comboBox (Units)
                comboboxName = i + "Combo3";
                ComboBox newCombo3 = new ComboBox();
                newCombo3.Name = comboboxName;
                newCombo3.Width = defaultWidth;
                newCombo3.Height = defaultHeight;
                newCombo3.Enabled = false;
                newCombo3.Location = new Point(locationX, currentYLoc);
                currentYLoc += defaultHeight;
                panelVariableControls.Controls.Add(newCombo3);
                EventInfo combo3Changed = newCombo3.GetType().GetEvent("TextChanged");
                combo3Changed.AddEventHandler(newCombo3, new EventHandler(this.combo3Changed));

                //4th comboBox (Sensor Location Type)
                comboboxName = i + "Combo4";
                ComboBox newCombo4 = new ComboBox();
                newCombo4.Name = comboboxName;
                newCombo4.Width = defaultWidth;
                newCombo4.Height = defaultHeight;
                newCombo4.Enabled = false;
                newCombo4.Location = new Point(locationX, currentYLoc);
                newCombo4.Items.Add("d - Depth below surface");
                newCombo4.Items.Add("h - Height above surface");
                newCombo4.Items.Add("e - Elevation from bottom");
                newCombo4.Items.Add("m - Masl");
                newCombo4.Items.Add("i - Integrated depth range");
                newCombo4.Items.Add("v - Variable depth");
                newCombo4.Items.Add("n - Position NA");
                newCombo4.AutoCompleteMode = AutoCompleteMode.Append;
                newCombo4.AutoCompleteSource = AutoCompleteSource.ListItems;

                currentYLoc += defaultHeight;
                panelVariableControls.Controls.Add(newCombo4);
                EventInfo combo4Changed = newCombo4.GetType().GetEvent("TextChanged");
                combo4Changed.AddEventHandler(newCombo4, new EventHandler(this.combo4Changed));

                //TextBox (Sensor Displacement 1)
                comboboxName = i + "Text1";
                TextBox newCombo5 = new TextBox();
                newCombo5.Name = comboboxName;
                newCombo5.Width = defaultWidth;
                newCombo5.Height = defaultHeight;
                newCombo5.Enabled = false;
                newCombo5.Location = new Point(locationX, currentYLoc);
                currentYLoc += defaultHeight;
                panelVariableControls.Controls.Add(newCombo5);
                EventInfo Text1Changed = newCombo5.GetType().GetEvent("TextChanged");
                Text1Changed.AddEventHandler(newCombo5, new EventHandler(this.Text1Changed));
                newCombo5.KeyDown += new KeyEventHandler(Text1_KeyDown);

                //Button (Accept new Header)
                comboboxName = i + "Btn";
                Button newButton = new Button();
                newButton.Name = comboboxName;
                newButton.Width = defaultWidth;
                newButton.Height = defaultHeight;
//.........这里部分代码省略.........
开发者ID:rwlamont,项目名称:GLEON,代码行数:101,代码来源:FrmMain.cs

示例2: InitUI

        /// <summary>
        /// Creates and initializes window UI.
        /// </summary>
        private void InitUI()
        {
            this.ClientSize = new Size(492,373);
            this.StartPosition = FormStartPosition.CenterParent;
            this.MinimumSize = new Size(500,400);
            this.MinimizeBox = false;
            this.Text = "Global Message Rule Add/Edit Action";
            this.Icon = ResManager.GetIcon("ruleaction.ico");

            #region Common UI

            //--- Common UI -------------------------------------------------------------------//
            m_pIcon = new PictureBox();
            m_pIcon.Size = new Size(32,32);
            m_pIcon.Location = new Point(10,10);
            m_pIcon.Image = ResManager.GetIcon("ruleaction.ico").ToBitmap();

            mt_Info = new Label();
            mt_Info.Size = new Size(200,32);
            mt_Info.Location = new Point(50,10);
            mt_Info.TextAlign = ContentAlignment.MiddleLeft;
            mt_Info.Text = "Specify action information.";

            m_pSeparator1 = new GroupBox();
            m_pSeparator1.Size = new Size(483,3);
            m_pSeparator1.Location = new Point(7,50);
            m_pSeparator1.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            mt_Description = new Label();
            mt_Description.Size = new Size(100,20);
            mt_Description.Location = new Point(0,60);
            mt_Description.TextAlign = ContentAlignment.MiddleRight;
            mt_Description.Text = "Description:";

            m_pDescription = new TextBox();
            m_pDescription.Size = new Size(380,20);
            m_pDescription.Location = new Point(105,60);

            mt_Action = new Label();
            mt_Action.Size = new Size(100,20);
            mt_Action.Location = new Point(0,85);
            mt_Action.TextAlign = ContentAlignment.MiddleRight;
            mt_Action.Text = "Action:";

            m_pAction = new ComboBox();
            m_pAction.Size = new Size(160,21);
            m_pAction.Location = new Point(105,85);
            m_pAction.DropDownStyle = ComboBoxStyle.DropDownList;
            try{
                // FIX ME: Mono throws exception
                // m_pAction.DropDownHeight = 200;
                m_pAction.GetType().GetProperty("DropDownHeight").GetSetMethod(true).Invoke(m_pAction,new object[]{200});
            }
            catch{
            }
            m_pAction.SelectedIndexChanged += new EventHandler(m_pAction_SelectedIndexChanged);
            m_pAction.Items.Add(new WComboBoxItem("Auto Response",GlobalMessageRuleAction_enum.AutoResponse));
            m_pAction.Items.Add(new WComboBoxItem("Delete Message",GlobalMessageRuleAction_enum.DeleteMessage));
            m_pAction.Items.Add(new WComboBoxItem("Execute Program",GlobalMessageRuleAction_enum.ExecuteProgram));
            m_pAction.Items.Add(new WComboBoxItem("Forward To Email",GlobalMessageRuleAction_enum.ForwardToEmail));
            m_pAction.Items.Add(new WComboBoxItem("Forward To Host",GlobalMessageRuleAction_enum.ForwardToHost));
            m_pAction.Items.Add(new WComboBoxItem("Store To Disk Folder",GlobalMessageRuleAction_enum.StoreToDiskFolder));
            m_pAction.Items.Add(new WComboBoxItem("Move To IMAP Folder",GlobalMessageRuleAction_enum.MoveToIMAPFolder));
            m_pAction.Items.Add(new WComboBoxItem("Add Header Field",GlobalMessageRuleAction_enum.AddHeaderField));
            m_pAction.Items.Add(new WComboBoxItem("Remove Header Field",GlobalMessageRuleAction_enum.RemoveHeaderField));
            m_pAction.Items.Add(new WComboBoxItem("Send Error To Client",GlobalMessageRuleAction_enum.SendErrorToClient));
            m_pAction.Items.Add(new WComboBoxItem("Store To FTP Folder",GlobalMessageRuleAction_enum.StoreToFTPFolder));
            m_pAction.Items.Add(new WComboBoxItem("Post To NNTP Newsgroup",GlobalMessageRuleAction_enum.PostToNNTPNewsGroup));
            m_pAction.Items.Add(new WComboBoxItem("Post To HTTP",GlobalMessageRuleAction_enum.PostToHTTP));

            m_pSeparator2 = new GroupBox();
            m_pSeparator2.Size = new Size(483,3);
            m_pSeparator2.Location = new Point(7,115);
            m_pSeparator2.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            m_pSeparator3 = new GroupBox();
            m_pSeparator3.Size = new Size(483,3);
            m_pSeparator3.Location = new Point(7,335);
            m_pSeparator3.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;

            m_pHelp = new Button();
            m_pHelp.Size = new Size(70,20);
            m_pHelp.Location = new Point(10,350);
            m_pHelp.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            m_pHelp.Text = "Help";
            m_pHelp.Click += new EventHandler(m_pHelp_Click);

            m_pCancel = new Button();
            m_pCancel.Size = new Size(70,20);
            m_pCancel.Location = new Point(340,350);
            m_pCancel.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            m_pCancel.Text = "Cancel";
            m_pCancel.Click += new EventHandler(m_pCancel_Click);

            m_Ok = new Button();
            m_Ok.Size = new Size(70,20);
            m_Ok.Location = new Point(415,350);
//.........这里部分代码省略.........
开发者ID:janemiceli,项目名称:authenticated_mail_server,代码行数:101,代码来源:wfrm_GlobalMessageRule_Action.cs

示例3: GetComboBoxState

        static string GetComboBoxState(ComboBox combobox)
        {
            Hashtable table = new Hashtable();
            table["style"] = combobox.DropDownStyle.ToString();
            table["index"] = combobox.SelectedIndex.ToString();

            return combobox.GetType().ToString() + ":"
                + StringUtil.BuildParameterString(table);
        }
开发者ID:paopaofeng,项目名称:dp2,代码行数:9,代码来源:GuiState.cs


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