This documentation is archived and is not being maintained.
Panel Constructor
.NET Framework 1.1
Initializes a new instance of the Panel class.
[Visual Basic] Public Sub New() [C#] public Panel(); [C++] public: Panel(); [JScript] public function Panel();
Example
[Visual Basic, C#] The following example illustrates how to create a new instance of the Panel control containing a Label control that is aligned to the right.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script language="VB" runat="server"> Sub Button1_Click(sender As Object, e As EventArgs) Dim pR As New Panel() pR.HorizontalAlign = HorizontalAlign.Right pR.Wrap = True pR.Height = New Unit(200) pR.Width = New Unit(200) pR.BackColor = System.Drawing.Color.Gainsboro Dim l As New Label() l.Text = "This panel contains a right justified label." pR.Controls.Add(l) Page.Controls.Add(pR) End Sub </script> </head> <body> <h3>Panel Example</h3> <form runat=server> <asp:Button id="Button1" OnClick="Button1_Click" Text="Create a Panel with right justified text" runat="server"/> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script language="C#" runat="server"> void Button1_Click(Object sender, EventArgs e) { Panel pR = new Panel(); pR.HorizontalAlign = HorizontalAlign.Right; pR.Wrap = true; pR.Height = 200; pR.Width = 200; pR.BackColor = System.Drawing.Color.Gainsboro; Label l = new Label(); l.Text = "This panel contains a right justified label."; pR.Controls.Add(l); Page.Controls.Add(pR); } </script> </head> <body> <h3>Panel Example</h3> <form runat=server> <asp:Button id="Button1" OnClick="Button1_Click" Text="Create a Panel with right justified text" runat="server"/> </form> </body> </html>
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Panel Class | Panel Members | System.Web.UI.WebControls Namespace
Show: