Check this code,
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Controls
{
public class CtlFloatingForm : Panel
{
/// <summary>
/// Class to create a ProgressBarPanel Control
/// </summary>
# region " Destructor "
/// <summary>
/// Clean up resource memory used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#endregion
#region " Globals "
// Global Variables
private Panel PnlWnd;
private Label LblText;
private TextBox txtBox;
private Button btnOk;
# endregion
# region " Paint Constructor "
/// <summary>
/// Constructor to build control
/// </summary>
public CtlFloatingForm()
{
//Set Form Rectangle Area
this.Bounds = new Rectangle(5,65,230,115);
//Set Form Background Color
this.BackColor = Color.Black;
//Add New Panel and Set Area
PnlWnd = new Panel();
PnlWnd.Bounds = new Rectangle(2, 2, this.Width - 4, this.Height -
4);
PnlWnd.BackColor = Color.White;
this.Controls.Add(PnlWnd);
//Add StatusBar Label
LblText = new Label();
LblText.Bounds = new Rectangle(10, 10, PnlWnd.Width - 20, 14);
LblText.Text = "";
this.LblText.Font = new System.Drawing.Font("Tahoma", 8.25F,
System.Drawing.FontStyle.Bold);
PnlWnd.Controls.Add(LblText);
//Add StatusBar Label
txtBox = new TextBox();
txtBox.Bounds = new Rectangle(10, 30, PnlWnd.Width - 20, 45);
txtBox.Font = new System.Drawing.Font("Tahoma", 8.25F,
System.Drawing.FontStyle.Bold);
txtBox.Multiline = true;
txtBox.MaxLength = 50;
txtBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
txtBox.Text = "";
PnlWnd.Controls.Add(txtBox);
btnOk = new Button();
btnOk.Bounds = new Rectangle(100, 85, 40, 20);
btnOk.Text = "Ok";
btnOk.Click +=new EventHandler(btnOk_Click);
PnlWnd.Controls.Add(btnOk);
}
# endregion
}
}
CtlFloatingForm class instantiates Panel and text box is placed in it.
Hope this helps,
Cheers,
Arun.
www.innasite.com