Button btn = new Button(); btn.Text = "Click Me"; btn.Location = new Point(50, 50); this.Controls.Add(btn);
Label label = new Label(); label.Text = "Hello World"; label.Location = new Point(50, 100); this.Controls.Add(label);In this example, a Label control is created and added to the form. The label's text is set to "Hello World" and its position is set to (50, 100) using the Point class. Package library: System.Windows.Forms.