Panel クラスとは? わかりやすく解説

Panel クラス

複数コントロール1 つモバイル Web フォーム ページ整理するコンテナ提供します

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Public Class Panel
    Inherits MobileControl
    Implements ITemplateable
public class Panel : MobileControl, ITemplateable
public ref class Panel : public
 MobileControl, ITemplateable
public class Panel extends MobileControl implements
 ITemplateable
public class Panel extends
 MobileControl implements ITemplateable
解説解説
使用例使用例

ページ読み込み中にパネルプロパティ設定する方法、およびパネルプロパティ操作してコマンド クリック応答するようにする関数定義する方法次のコード例示します。このコードまた、ページ読み込み時にデバイス固有のコンテンツ テンプレート内のラベル検索し、第 2 のパネル内でこれを変更します

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Drawing" %>

<script runat="server">
    public void Page_Load(Object sender, EventArgs
 e)
    {
        // Set Panel1 properties
        Panel1.Wrapping = Wrapping.NoWrap;
        Panel1.Alignment = Alignment.Center;
        Panel1.StyleReference = "title";

        // Find Label in Panel2
        Control ctl = Panel2.Content.FindControl("lblStatusToday");
        if (ctl != null)
            ((System.Web.UI.MobileControls.Label)ctl).Text
                = "I found this label";
    }
    
    public void MakeFontRed(Object sender,
 EventArgs e)
    {
        Panel1.ForeColor = Color.Red;
    }
    
    public void MakeFontBlue(Object sender,
 EventArgs e)
    {
        Panel1.ForeColor = Color.Blue;
    }
</script>

<html  >
<body>
<mobile:Form runat="server" id="Form1">
    <!-- First Panel -->
    <mobile:Panel runat="server" id="Panel1">
        <mobile:TextView runat="server" id="TextView1">
            A Panel provides a grouping mechanism<br />
            for organizing controls.
        </mobile:TextView>
    </mobile:Panel>
    <mobile:Command runat="server" id="Command1"  BreakAfter="false"
        Text="Make Font Red" OnClick="MakeFontRed"/>
    <mobile:Command runat="server" id="Command2" BreakAfter="true"
        Text="Make Font Blue" OnClick="MakeFontBlue"/>

    <!-- Second Panel -->
    <mobile:Panel ID="Panel2"  Runat="server">
        <mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
            <!-- Filter and template for HTML32 devices -->
            <Choice Filter="isHTML32" 
                Xmlns="http://schemas.microsoft.com/mobile/html32template">
                <ContentTemplate>
                    <mobile:Label id="Label1" runat="server">
                        HTML32 Template</mobile:Label>
                    <mobile:Label ID="lblStatusToday" Runat="server"/>
                </ContentTemplate>
            </Choice>
            <!-- Default filter and template -->
            <Choice>
                <ContentTemplate>
                    <mobile:Label ID="Label1" Runat="server">
                        Default Template</mobile:Label>
                    <mobile:Label ID="lblStatusToday" Runat="server"
 />
                </ContentTemplate>
            </Choice>
        </mobile:DeviceSpecific>
    </mobile:Panel>
</mobile:Form>
</body>
</html>

このセクションは、Web.config ファイルにも追加する必要があります

.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.MobileControls.MobileControl
      System.Web.UI.MobileControls.Panel
         System.Web.UI.MobileControls.Form
         System.Web.UI.MobileControls.TemplateContainer
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Panel クラス

ほかのコントロールコンテナ役割を果たすコントロール表します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class Panel
    Inherits WebControl
public class Panel : WebControl
public class Panel extends WebControl
public class Panel extends
 WebControl
解説解説

Panel コントロールは、ほかのコントロールコンテナです。プログラムによってコントロール生成したり、コントロールグループの非表示/表示切り替えたり、コントロールグループローカライズしたりする場合に特に役立ちます

Direction プロパティは、アラビア語ヘブライ語などの右から左記述する言語テキスト表示するために Panel コントロール内容ローカライズする場合役立ちます

Panel コントロールには、その内容動作表示カスタマイズできるプロパティいくつか用意されています。BackImageUrl プロパティ使用してPanel コントロールカスタム イメージ表示します。ScrollBars プロパティ使用してコントロールスクロール バー指定します

使用例使用例

Panel コントロール使用してプログラムによってコントロール生成しコントロールグループの非表示/表示切り替える方法次の例に示します

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要がありますWeb フォームコード モデル詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<html>
 <head>
 
    <script runat="server">

    Sub Page_Load(sender As Object,
 e As EventArgs)
        
        ' Show or Hide the Panel contents.
        If Check1.Checked Then
            Panel1.Visible = False
        Else
            Panel1.Visible = True
        End If
        
        ' Generate the Label controls.
        Dim numlabels As Integer
 = Int32.Parse(DropDown1.SelectedItem.Value)
        
        Dim i As Integer
        For i = 1 To numlabels
            Dim l As New
 Label()
            l.Text = "Label" + i.ToString()
            l.ID = "Label" + i.ToString()
            Panel1.Controls.Add(l)
            Panel1.Controls.Add(New LiteralControl("<br>"))
        Next i
        
        ' Generate the Textbox controls.
        Dim numtexts As Integer
 = Int32.Parse(DropDown2.SelectedItem.Value)
        
        For i = 1 To numtexts
            Dim t As New
 TextBox()
            t.Text = "TextBox" & i.ToString()
            t.ID = "TextBox" & i.ToString()
            Panel1.Controls.Add(t)
            Panel1.Controls.Add(New LiteralControl("<br>"))
        Next i
    End Sub
 
    </script>
 
 </head>
 <body>
 
    <h3>Panel Example</h3>
 
    <form runat=server>
 
       <asp:Panel id="Panel1" runat="server"
            BackColor="gainsboro"
            Height="200px"
            Width="300px">
 
            Panel1: Here is some static content...
            <p>
 
       </asp:Panel>
 
       <p>
         
       Generate Labels:
       <asp:DropDownList id=DropDown1 runat="server">
          <asp:ListItem Value="0">0</asp:ListItem>
          <asp:ListItem Value="1">1</asp:ListItem>
          <asp:ListItem Value="2">2</asp:ListItem>
          <asp:ListItem Value="3">3</asp:ListItem>
          <asp:ListItem Value="4">4</asp:ListItem>
       </asp:DropDownList>
 
       <br>
         
       Generate TextBoxes:
       <asp:DropDownList id=DropDown2 runat="server">
          <asp:ListItem Value="0">0</asp:ListItem>
          <asp:ListItem Value="1">1</asp:ListItem>
          <asp:ListItem Value="2">2</asp:ListItem>
          <asp:ListItem Value="3">3</asp:ListItem>
          <asp:ListItem Value="4">4</asp:ListItem>
       </asp:DropDownList>
 
       <p>
       <asp:CheckBox id="Check1" Text="Hide
 Panel" runat="server"/>
             
       <p>
       <asp:Button Text="Refresh Panel" runat="server"/>
 
    
    </form>
 
 </body>
 </html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
 <head>
 
    <script runat="server">
 
       void Page_Load(Object sender, EventArgs e) {
         
          // Show or hide the Panel contents.
         
          if (Check1.Checked) {
             Panel1.Visible=false;
          }
          else {
             Panel1.Visible=true;
          }
 
          // Generate the Label controls.
             
          int numlabels = Int32.Parse(DropDown1.SelectedItem.Value);
             
          for (int i=1; i<=numlabels; i++)
 {
             Label l = new Label();
             l.Text = "Label" + (i).ToString();
             l.ID = "Label" + (i).ToString();
             Panel1.Controls.Add(l);
             Panel1.Controls.Add(new LiteralControl("<br>"));
          }
 
          // Generate the Textbox controls.
             
          int numtexts = Int32.Parse(DropDown2.SelectedItem.Value);
             
          for (int i=1; i<=numtexts; i++)
 {
             TextBox t = new TextBox();
             t.Text = "TextBox" + (i).ToString();
             t.ID = "TextBox" + (i).ToString();
             Panel1.Controls.Add(t);
             Panel1.Controls.Add(new LiteralControl("<br>"));
          }
       }
 
    </script>
 
 </head>
 <body>
 
    <h3>Panel Example</h3>
 
    <form runat=server>
 
       <asp:Panel id="Panel1" runat="server"
            BackColor="gainsboro"
            Height="200px"
            Width="300px">
 
            Panel1: Here is some static content...
            <p>
 
       </asp:Panel>
 
       <p>
         
       Generate Labels:
       <asp:DropDownList id=DropDown1 runat="server">
          <asp:ListItem Value="0">0</asp:ListItem>
          <asp:ListItem Value="1">1</asp:ListItem>
          <asp:ListItem Value="2">2</asp:ListItem>
          <asp:ListItem Value="3">3</asp:ListItem>
          <asp:ListItem Value="4">4</asp:ListItem>
       </asp:DropDownList>
 
       <br>
         
       Generate TextBoxes:
       <asp:DropDownList id=DropDown2 runat="server">
          <asp:ListItem Value="0">0</asp:ListItem>
          <asp:ListItem Value="1">1</asp:ListItem>
          <asp:ListItem Value="2">2</asp:ListItem>
          <asp:ListItem Value="3">3</asp:ListItem>
          <asp:ListItem Value="4">4</asp:ListItem>
       </asp:DropDownList>
 
       <p>
       <asp:CheckBox id="Check1" Text="Hide Panel" runat="server"/>
             
       <p>
       <asp:Button Text="Refresh Panel" runat="server"/>
 
    
    </form>
 
 </body>
 </html>
 
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Panel
         System.Web.UI.WebControls.WebParts.Part
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Panel クラス

コントロールコレクショングループ化するために使用されます。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class Panel
    Inherits ScrollableControl
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class Panel : ScrollableControl
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class Panel : public
 ScrollableControl
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class Panel extends ScrollableControl
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class Panel extends
 ScrollableControl
解説解説
使用例使用例

Panel コントロール作成しLabel および TextBoxPanel追加するコード例次に示しますPanel コントロールは、Panel コントロール位置する所をフォーム上のほかのオブジェクト区別するために 3D 境界線付き表示されます。この例では、ここで定義されているメソッド既存フォーム内から呼び出されSystem.Drawing 名前空間が、そのフォームソース コード追加されていることを前提にしています。

Public Sub CreateMyPanel()
    Dim panel1 As New Panel()
    Dim textBox1 As New
 TextBox()
    Dim label1 As New Label()
    
    ' Initialize the Panel control.
    panel1.Location = New Point(56, 72)
    panel1.Size = New Size(264, 152)
    ' Set the Borderstyle for the Panel to three-dimensional.
    panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    
    ' Initialize the Label and TextBox controls.
    label1.Location = New Point(16, 16)
    label1.Text = "label1"
    label1.Size = New Size(104, 16)
    textBox1.Location = New Point(16, 32)
    textBox1.Text = ""
    textBox1.Size = New Size(152, 20)
    
    ' Add the Panel control to the form.
    Me.Controls.Add(panel1)
    ' Add the Label and TextBox controls to the Panel.
    panel1.Controls.Add(label1)
    panel1.Controls.Add(textBox1)
End Sub

public void CreateMyPanel()
{
   Panel panel1 = new Panel();
   TextBox textBox1 = new TextBox();
   Label label1 = new Label();
   
   // Initialize the Panel control.
   panel1.Location = new Point(56,72);
   panel1.Size = new Size(264, 152);
   // Set the Borderstyle for the Panel to three-dimensional.
   panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;

   // Initialize the Label and TextBox controls.
   label1.Location = new Point(16,16);
   label1.Text = "label1";
   label1.Size = new Size(104, 16);
   textBox1.Location = new Point(16,32);
   textBox1.Text = "";
   textBox1.Size = new Size(152, 20);

   // Add the Panel control to the form.
   this.Controls.Add(panel1);
   // Add the Label and TextBox controls to the Panel.
   panel1.Controls.Add(label1);
   panel1.Controls.Add(textBox1);
}

public:
   void CreateMyPanel()
   {
      Panel^ panel1 = gcnew Panel;
      TextBox^ textBox1 = gcnew TextBox;
      Label^ label1 = gcnew Label;
      
      // Initialize the Panel control.
      panel1->Location = System::Drawing::Point( 56, 72 );
      panel1->Size = System::Drawing::Size( 264, 152 );
      // Set the Borderstyle for the Panel to three-dimensional.
      panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
      
      // Initialize the Label and TextBox controls.
      label1->Location = System::Drawing::Point( 16, 16 );
      label1->Text = "label1";
      label1->Size = System::Drawing::Size( 104, 16 );
      textBox1->Location = System::Drawing::Point( 16, 32 );
      textBox1->Text = "";
      textBox1->Size = System::Drawing::Size( 152, 20 );
      
      // Add the Panel control to the form.
      this->Controls->Add( panel1 );
      // Add the Label and TextBox controls to the Panel.
      panel1->Controls->Add( label1 );
      panel1->Controls->Add( textBox1 );
   }
public void CreateMyPanel()
{
    Panel panel1 = new Panel();
    TextBox textBox1 = new TextBox();
    Label label1 = new Label();

    // Initialize the Panel control.
    panel1.set_Location(new Point(56, 72));
    panel1.set_Size(new Size(264, 152));

    // Set the Borderstyle for the Panel to three-dimensional.
    panel1.set_BorderStyle(System.Windows.Forms.BorderStyle.Fixed3D);

    // Initialize the Label and TextBox controls.
    label1.set_Location(new Point(16, 16));
    label1.set_Text("label1");
    label1.set_Size(new Size(104, 16));
    textBox1.set_Location(new Point(16, 32));
    textBox1.set_Text("");
    textBox1.set_Size(new Size(152, 20));

    // Add the Panel control to the form.
    this.get_Controls().Add(panel1);

    // Add the Label and TextBox controls to the Panel.
    panel1.get_Controls().Add(label1);
    panel1.get_Controls().Add(textBox1);
} //CreateMyPanel
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ScrollableControl
          System.Windows.Forms.Panel
             派生クラス
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からPanel クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からPanel クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からPanel クラスを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Panel クラス」の関連用語

Panel クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Panel クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS