WebControl.BorderColor プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebControl.BorderColor プロパティの意味・解説 

WebControl.BorderColor プロパティ

Web コントロール境界線の色を取得または設定します

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

Public Overridable Property
 BorderColor As Color
Dim instance As WebControl
Dim value As Color

value = instance.BorderColor

instance.BorderColor = value
public virtual Color BorderColor { get; set;
 }
/** @property */
public Color get_BorderColor ()

/** @property */
public void set_BorderColor (Color value)
public function get BorderColor
 () : Color

public function set BorderColor
 (value : Color)

プロパティ
コントロール境界線の色を表す Color既定値Empty です。このプロパティ設定されていないことを示します

解説解説

BorderColor プロパティ使用してWeb サーバー コントロール境界線の色を指定します。このプロパティColor オブジェクト使用して設定します

メモメモ

BorderColor プロパティは、特定のコントロールだけに表示されます。たとえば、TablePanel、DataGrid、Calendar、ValidationSummary などのコントロールには、このプロパティ表示されます。また、このプロパティは、RepeatLayout プロパティRepeatLayout.Table設定されRepeatLayout.Flowない場合は、CheckBoxList、RadioButtonList、および DataList の各コントロールでも機能します。ただし、このプロパティは、HTML 3.2 標準には含まれないbordercolor 属性として表示されます。bordercolor 属性は、Microsoft Internet Explorer Version 3.0 以降では機能しますが、他のほとんどのブラウザでは機能しません。

BorderColor プロパティ設定されていない場合ブラウザ既定境界線の色を使用しますブラウザ既定配色確認するには、お使いブラウザ参照してください

使用例使用例

WebControl 基本クラスから継承された、Table コントロールBorderColor プロパティ設定方法の例を次に示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<html>
 <body>
     <h3>BorderColor Property of a Web
 Control</h3>
 
 <form runat=server>
 
 <asp:Table id="Table1" runat="server"
    CellPadding=10 
    GridLines="Both"
    
    BorderColor="Brown"
 >
 
    <asp:TableRow>
       <asp:TableCell>
          Row 0, Col 0
       </asp:TableCell>
 
       <asp:TableCell>
          Row 0, Col 1
       </asp:TableCell>
    </asp:TableRow>
 
    <asp:TableRow>
       <asp:TableCell>
          Row 1, Col 0
       </asp:TableCell>
 
       <asp:TableCell>
          Row 1, Col 1
       </asp:TableCell>
    </asp:TableRow>
 
 </asp:Table>
 
 </form>
 
 </body>
 </html>
 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
 <body>
     <h3>BorderColor Property of a Web Control</h3>
 
 <form runat=server>
 
 <asp:Table id="Table1" runat="server"
    CellPadding=10 
    GridLines="Both"
    
    BorderColor="Brown"
 >
 
    <asp:TableRow>
       <asp:TableCell>
          Row 0, Col 0
       </asp:TableCell>
 
       <asp:TableCell>
          Row 0, Col 1
       </asp:TableCell>
    </asp:TableRow>
 
    <asp:TableRow>
       <asp:TableCell>
          Row 1, Col 0
       </asp:TableCell>
 
       <asp:TableCell>
          Row 1, Col 1
       </asp:TableCell>
    </asp:TableRow>
 
 </asp:Table>
 
 </form>
 
 </body>
 </html>
 
<%@ Page Language="JScript" AutoEventWireup="True" %>
<html>
 <body>
     <h3>BorderColor Property of a Web Control</h3>
 
 <form runat=server>
 
 <asp:Table id="Table1" runat="server"
    CellPadding=10 
    GridLines="Both"
    
    BorderColor="Brown"
 >
 
    <asp:TableRow>
       <asp:TableCell>
          Row 0, Col 0
       </asp:TableCell>
 
       <asp:TableCell>
          Row 0, Col 1
       </asp:TableCell>
    </asp:TableRow>
 
    <asp:TableRow>
       <asp:TableCell>
          Row 1, Col 0
       </asp:TableCell>
 
       <asp:TableCell>
          Row 1, Col 1
       </asp:TableCell>
    </asp:TableRow>
 
 </asp:Table>
 
 </form>
 
 </body>
 </html>
 
メモメモ

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

<!-- This example demonstrates how to set
 property values for the
BorderColor, BorderStyle, and BorderWidth properties, and
 how to 
change the property values at run time. -->

<br /><span space="preserve">...</span><br
 /><%@ Page language="VB" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing"
 %>

<HTML>
    <HEAD>
        <SCRIPT runat="server">
            Private Sub Page_Load(sender As
 Object, e As System.EventArgs)
                ' Determine whether this is the first time the page
 is loaded;
                ' if so, load the drop-down lists with data.
                If Not Page.IsPostBack Then
                    ' Create a ListItemCollection and add names of colors.
                    Dim colors As New
 ListItemCollection()
                    colors.Add(Color.Black.Name)
                    colors.Add(Color.Blue.Name)
                    colors.Add(Color.Green.Name)
                    colors.Add(Color.Orange.Name)
                    colors.Add(Color.Purple.Name)
                    colors.Add(Color.Red.Name)
                    colors.Add(Color.White.Name)
                    colors.Add(Color.Yellow.Name)
                    ' Bind the colors collection to the borderColorList.
                    borderColorList.DataSource = colors
                    borderColorList.DataBind()

                    ' Create a ListItemCollection and the add names
 of 
                    ' the BorderStyle enumeration values.
                    Dim styles As New
 ListItemCollection()
                    Dim styleType As Type =
 GetType(BorderStyle)

                    Dim s As String
                    For Each s In
  [Enum].GetNames(styleType)
                        styles.Add(s)
                    Next s

                    ' Bind the styles collection to the borderStyleList.
                    borderStyleList.DataSource = styles
                    borderStyleList.DataBind()

                    ' Create a ListItemCollection and add width values
                    ' expressed in pixels (px).
                    Dim widths As New
 ListItemCollection()

                    Dim i As Integer
                    For i = 0 To 10
                        widths.Add(i.ToString() & "px")
                    Next i

                    ' Bind the widths collection to the borderWidthList.
                    borderWidthList.DataSource = widths
                    borderWidthList.DataBind()
                End If
            End Sub

            ' This method handles the SelectedIndexChanged event for
 borderColorList.
            Public Sub ChangeBorderColor(sender
 As Object, e As System.EventArgs)
                ' Convert the color name string to an object of type
 Color, 
                ' and set the Color as the new border color for Label1.
                Label1.BorderColor = Color.FromName(borderColorList.SelectedItem.Text)
            End Sub

            ' This method handles the selectedIndexChanged event for
 boderStyleList.
            Public Sub ChangeBorderStyle(sender
 As Object, e As System.EventArgs)
                ' Convert the style name string to a BorderStyle enumeration
 value,
                ' and set the BorderStyle as the new border style for
 Label1.
                Dim styleType As Type = GetType(BorderStyle)
                Label1.BorderStyle = [Enum].Parse(styleType, borderStyleList.SelectedItem.Text)
            End Sub

            ' This method handles the SelectedIndexChanged event for
 borderWidthList.
            Public Sub ChangeBorderWidth(sender
 As Object, e As System.EventArgs)
                ' Convert the border width string to a object of type
 Unit,
                ' and set the Unit as the new border width for Label1.
                Label1.BorderWidth = Unit.Parse(borderWidthList.SelectedItem.Text)
            End Sub
    </SCRIPT>
    </HEAD>

    <BODY>
        <form runat="server">

            <h3> Border Properties Example </h3>

            <table border="0" cellpadding="6">
                <tr>
                    <td>
                        <asp:Label Runat="server"
 BorderColor="Black" 
                            BorderStyle="Solid" BorderWidth="4px"
 ID="Label1" 
                            Text="Border Properties Example"
 Height="75" 
                            Width="200"><center><br>Border
 Properties Example
                            </center></asp:Label>
                    </td>

                    <td>
                        <asp:DropDownList Runat="server"
 ID="borderColorList" 
                            OnSelectedIndexChanged="ChangeBorderColor"
 AutoPostBack="True" 
                            EnableViewState="True"></asp:DropDownList>
                        <br>
                        <br>
                        <asp:DropDownList Runat="server"
 ID="borderStyleList" 
                            OnSelectedIndexChanged="ChangeBorderStyle"
 AutoPostBack="True" 
                            EnableViewState="True"></asp:DropDownList>
                        <br>            
                        <br>
                        <asp:DropDownList Runat="server"
 ID="borderWidthList" 
                            OnSelectedIndexChanged="ChangeBorderWidth"
 AutoPostBack="True"
                            EnableViewState="True"></asp:DropDownList>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</HTML>
<!-- This example demonstrates how to set property values for
 the
BorderColor, BorderStyle, and BorderWidth properties, and how to 
change the property values at run time. -->

<br /><span space="preserve">...</span><br /><%@
 Page language="c#" AutoEventWireup="true"
 %>
<%@ Import Namespace="System.Drawing" %>

<HTML>
    <HEAD>
        <SCRIPT runat="server">
            private void Page_Load(object sender,
 System.EventArgs e)
            {
                // Determine whether this is the first time the page
 is loaded;
                // if so, load the drop-down lists with data.
                if (!Page.IsPostBack)
                {
                    // Create a ListItemCollection and add names of
 colors.
                    ListItemCollection colors = new ListItemCollection();
                    colors.Add(Color.Black.Name);
                    colors.Add(Color.Blue.Name);
                    colors.Add(Color.Green.Name);
                    colors.Add(Color.Orange.Name);
                    colors.Add(Color.Purple.Name);
                    colors.Add(Color.Red.Name);
                    colors.Add(Color.White.Name);
                    colors.Add(Color.Yellow.Name);
                    // Bind the colors collection to the borderColorList.
                    borderColorList.DataSource = colors;
                    borderColorList.DataBind();

                    // Create a ListItemCollection and the add names
 of 
                    // the BorderStyle enumeration values.
                    ListItemCollection styles = new ListItemCollection();

                    foreach (string s in
 Enum.GetNames(typeof(BorderStyle)))
                    {
                        styles.Add(s);
                    }

                    // Bind the styles collection to the borderStyleList.
                    borderStyleList.DataSource = styles;
                    borderStyleList.DataBind();

                    // Create a ListItemCollection and add width values
                    // expressed in pixels (px).
                    ListItemCollection widths = new ListItemCollection();

                    for (int i = 0; i <
 11; i++)
                    {
                        widths.Add(i.ToString() + "px");
                    }

                    // Bind the widths collection to the borderWidthList.
                    borderWidthList.DataSource = widths;
                    borderWidthList.DataBind();
                }

            }

            // This method handles the SelectedIndexChanged event for
 borderColorList.
            public void ChangeBorderColor(object
 sender, System.EventArgs e)
            {
                // Convert the color name string to an object of type
 Color, 
                // and set the Color as the new border color for Label1.
                Label1.BorderColor = Color.FromName(borderColorList.SelectedItem.Text);
            }

            // This method handles the selectedIndexChanged event for
 boderStyleList.
            public void ChangeBorderStyle(object
 sender, System.EventArgs e)
            {
                // Convert the style name string to a BorderStyle enumeration
 value,
                // and set the BorderStyle as the new border style for
 Label1.
                Label1.BorderStyle = (BorderStyle)Enum.Parse(typeof(BorderStyle)
,
                                      borderStyleList.SelectedItem.Text);
            }

            // This method handles the SelectedIndexChanged event for
 borderWidthList.
            public void ChangeBorderWidth(object
 sender, System.EventArgs e)
            {
                // Convert the border width string to a object of type
 Unit,
                // and set the Unit as the new border width for Label1.
                Label1.BorderWidth = Unit.Parse(borderWidthList.SelectedItem.Text);
            }
    </SCRIPT>
    </HEAD>

    <BODY>
        <form runat="server">

            <h3> Border Properties Example </h3>

            <table border="0" cellpadding="6">
                <tr>
                    <td>
                        <asp:Label Runat="server" BorderColor="Black"
 
                            BorderStyle="Solid" BorderWidth="4px"
 ID="Label1" 
                            Text="Border Properties Example" Height="75"
 
                            Width="200"><center><br>Border
 Properties Example
                            </center></asp:Label>
                    </td>

                    <td>
                        <asp:DropDownList Runat="server" ID="borderColorList"
 
                            OnSelectedIndexChanged="ChangeBorderColor"
 AutoPostBack="True" 
                            EnableViewState="True"></asp:DropDownList>
                        <br>
                        <br>
                        <asp:DropDownList Runat="server" ID="borderStyleList"
 
                            OnSelectedIndexChanged="ChangeBorderStyle"
 AutoPostBack="True" 
                            EnableViewState="True"></asp:DropDownList>
                        <br>            
                        <br>
                        <asp:DropDownList Runat="server" ID="borderWidthList"
 
                            OnSelectedIndexChanged="ChangeBorderWidth"
 AutoPostBack="True"
                            EnableViewState="True"></asp:DropDownList>
                    </td>
                </tr>
            </table>
        </form>
    </body>
</HTML>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

「WebControl.BorderColor プロパティ」の関連用語

WebControl.BorderColor プロパティのお隣キーワード
検索ランキング

   

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



WebControl.BorderColor プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS