System.Windows.Forms.ControlCollection.Add C# (CSharp) Method

Add() public method

public Add ( Control item ) : void
item Control
return void
		public void Add (Control item)
		{
			theView.AddSubview (item);
			SetTab ();
		}
		public void AddRange (Control[] InControls)

Usage Example

		/// <summary>
		/// Creates a multiline label with its height fitted to the text
		/// </summary>
		/// <param name="text">The text for the label</param>
		/// <param name="graphics">The graphics context to use for measuring the text</param>
		/// <param name="width">The available width</param>
		/// <param name="controls">The collection to add the label to</param>
		private void AddNewLabel(string text, Graphics graphics, int width, ControlCollection controls)
		{
			Label label = new Label()
			{
				Visible = false,
				AutoSize = false,
				Dock = DockStyle.Top,
				Text = text
			};
			SizeF size = graphics.MeasureString(text, label.Font, width);
			label.Height = (int) Math.Round(size.Height + 8);

			controls.Add(label);
			label.BringToFront();
		}
All Usage Examples Of System.Windows.Forms.ControlCollection::Add