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


C# TextBox.GetType方法代码示例

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


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

示例1: NumericUpDownEx

 /// <summary>
 /// object creator
 /// </summary>
 public NumericUpDownEx()
     : base()
 {
     // get a reference to the underlying UpDownButtons field
     // Underlying private type is System.Windows.Forms.UpDownBase+UpDownButtons
     _upDownButtons = base.Controls[0];
     if (_upDownButtons == null || _upDownButtons.GetType().FullName != "System.Windows.Forms.UpDownBase+UpDownButtons") {
         throw new ArgumentNullException(this.GetType().FullName + ": Can't find internal UpDown buttons field.");
     }
     // Get a reference to the underlying TextBox field.
     // Underlying private type is System.Windows.Forms.UpDownBase+UpDownButtons
     _textbox = base.Controls[1] as TextBox;
     if (_textbox == null || _textbox.GetType().FullName != "System.Windows.Forms.UpDownBase+UpDownEdit") {
         throw new ArgumentNullException(this.GetType().FullName + ": Can't find internal TextBox field.");
     }
     // add handlers (MouseEnter and MouseLeave events of NumericUpDown
     // are not working properly)
     _textbox.MouseEnter += _mouseEnterLeave;
     _textbox.MouseLeave += _mouseEnterLeave;
     _upDownButtons.MouseEnter += _mouseEnterLeave;
     _upDownButtons.MouseLeave += _mouseEnterLeave;
     base.MouseEnter += _mouseEnterLeave;
     base.MouseLeave += _mouseEnterLeave;
 }
开发者ID:MEZboy,项目名称:csharpsrc,代码行数:27,代码来源:NumericUpDownEx.cs

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

示例3: Transform

        /// <summary>
        /// Transform the text box to be identical to <paramref name="source"/>.
        /// </summary>
        /// <param name="source">The text box to transform into</param>
        /// <param name="hideSource">Hide the source text box after the transformation is complete</param>
        public void Transform(TextBox source, bool hideSource)
        {
            Type type = source.GetType();
            IEnumerator properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => p.CanRead && p.CanWrite && !p.Name.Equals("WindowTarget")).GetEnumerator();
            while (properties.MoveNext())
            {
                PropertyInfo property = properties.Current as PropertyInfo;
                object value = property.GetValue(source, null);
                property.SetValue(this, value, null);
            }

            source.Visible = !hideSource;
            this.previousText = this.Text;
        }
开发者ID:rastating,项目名称:temporaltextbox,代码行数:19,代码来源:TemporalTextBox.cs

示例4: GetTextBoxState

 static string GetTextBoxState(TextBox textbox)
 {
     return textbox.GetType().ToString() + ":" + StringUtil.EscapeString(textbox.Text, ":;,");
 }
开发者ID:paopaofeng,项目名称:dp2,代码行数:4,代码来源:GuiState.cs


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