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


C# ComboBox.ToString方法代码示例

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


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

示例1: InitializeComponent


//.........这里部分代码省略.........
				"Vilanova de Bellpuig           ",
				"Vilanova de Meià               ",
				"Vilanova de Prades             ",
				"Vilanova de Sau                ",
				"Vilanova de Segrià             ",
				"Vilanova de l'Aguda            ",
				"Vilanova de la Barca           ",
				"Vilanova del Camí              ",
				"Vilanova del Vallès            ",
				"Vilanova i la Geltrú           ",
				"Vilaplana                      ",
				"Vilassar de Dalt               ",
				"Vilassar de Mar                ",
				"Vilaverd                       ",
				"Vilaür                         ",
				"Vilella Alta                   ",
				"Vilella Baixa                  ",
				"Vilobí d'Onyar                 ",
				"Vilobí del Penedès             ",
				"Vilopriu                       ",
				"Vilosell                       ",
				"Vimbodí                        ",
				"Vinaixa                        ",
				"Vinebre                        ",
				"Vinyols i els Arcs             ",
				"Viver i Serrateix              ",
				"Xerta                          "

			});

			/* Buttons */
			buttonSimple = new Button ();
			buttonSimple.Location = new Point (280, 30);
			buttonSimple.Text = "Simple";
			buttonSimple.Size = new Size (100, 23);
			buttonSimple.Click += new System.EventHandler (buttonSimpleClick);

			buttonDropDown = new Button ();
			buttonDropDown.Location = new Point (280, 80);
			buttonDropDown.Text = "DropList";
			buttonDropDown.Size = new Size (100, 23);
			buttonDropDown.Click += new System.EventHandler (buttonDropDownClick);

			buttonDropDownList = new Button ();
			buttonDropDownList.Location = new Point (280, 130);
			buttonDropDownList.Text = "DropDownList";
			buttonDropDownList.Size = new Size (100, 23);
			buttonDropDownList.Click += new System.EventHandler (buttonDropDownListClick);
						
			comboBox.Location = new System.Drawing.Point(8, 32);
			comboBox.Name = "comboBox";
			comboBox.Size = new System.Drawing.Size (248, 150);
			comboBox.TabIndex = 0;
			//comboBox.Text = "A normal ComboBox";
			comboBox.DropDownStyle = ComboBoxStyle.Simple;
			comboBox.MaxDropDownItems = 10;
			//comboBox.ItemHeight = false;
			
			buttonDropDownAction = new Button ();
			buttonDropDownAction.Location = new Point (400, 130);
			buttonDropDownAction.Text = "DropDown action";
			buttonDropDownAction.Size = new Size (100, 23);
			buttonDropDownAction.Click += new System.EventHandler (buttonDropDownListActionClick);
						
			
			buttonAddItems = new Button ();
			buttonAddItems.Location = new Point (400, 30);
			buttonAddItems.Text = "Add Items";
			buttonAddItems.Size = new Size (100, 23);
			buttonAddItems.Click += new System.EventHandler (buttonAddItemsClick);
			
			buttonCleanItems = new Button ();
			buttonCleanItems.Location = new Point (400, 80);
			buttonCleanItems.Text = "Clean Items";
			buttonCleanItems.Size = new Size (100, 23);
			buttonCleanItems.Click += new System.EventHandler (buttonCleanItemsClick);
					
			
			//this.comboBox.IntegralHeight = true;			
			//comboBox.Font = new System.Drawing.Font (comboBox.Font.FontFamily, comboBox.Font.Size + 5);
			
			
			// 
			// MainForm
			// 
			this.ClientSize = new System.Drawing.Size(624, 309);
			this.Controls.AddRange(new Control[] { buttonAddItems, buttonCleanItems,
						comboBox, buttonSimple, buttonDropDown, buttonDropDownList,
						buttonDropDownAction});
						
			this.Text = "Single ComboBox sample";
			this.ResumeLayout(false);
			
			Console.WriteLine ("ComboBox Size {0}", comboBox.Size);
			Console.WriteLine ("ComboBox IntegralHeight {0}", comboBox.IntegralHeight);
			Console.WriteLine ("ComboBox ItemHeight {0}", comboBox.ItemHeight);
			Console.WriteLine ("ComboBox FontHeight {0}", comboBox.Font.Height);			
			Console.WriteLine ("ComboBox String {0}", comboBox.ToString ());		
			
		}
开发者ID:hitswa,项目名称:winforms,代码行数:101,代码来源:swf-combobox-single.cs


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