... Rectangle r = GetTextBounds(textBox1, 2, 10); Panel panel = new Panel { Bounds = r, BorderStyle = BorderStyle.FixedSingle, }; this.Controls.Add(panel); panel.Show(); panel.BringToFront(); ...