다음을 통해 공유


DropDownList.BorderColor 속성

정의

컨트롤의 테두리 색을 가져오거나 설정합니다.

public:
 virtual property System::Drawing::Color BorderColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
[System.ComponentModel.Browsable(false)]
public override System.Drawing.Color BorderColor { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.BorderColor : System.Drawing.Color with get, set
Public Overrides Property BorderColor As Color

속성 값

Color

컨트롤의 테두리 색을 나타내는 Color입니다.

특성

예제

다음 코드 예제에서는 사용자 지정 DropDownList 컨트롤에서 BorderColor 속성을 가져오기 또는 설정 하는 방법을 보여 줍니다. 사용자 지정 서버 컨트롤을 사용하는 방법에 대한 자세한 내용은 연습: 사용자 지정 웹 서버 컨트롤 개발 및 사용을 참조하세요.

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>Custom DropDownList - BorderColor - C# Example</title>
    <script runat="server">
      private void Page_Load(object sender, System.EventArgs e)
      {
          DropDownList1.Items.Add(new ListItem("Item1", "Item1"));
          DropDownList1.Items.Add(new ListItem("Item2", "Item2"));
          DropDownList1.Items.Add(new ListItem("Item2", "Item2"));
      }
    </script>
  </head>
  <body>
      <form id="Form1" method="post" runat="server">
          <h3>Custom DropDownList - BorderColor - C# Example</h3>

          <aspSample:CustomDropDownListBorderColor
          id="DropDownList1"
          runat="server" />

      </form>
  </body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Custom DropDownList - BorderColor - VB.NET Example</title>
        <script runat="server">
            Sub Page_Load(sender As Object, e As EventArgs)
                DropDownList1.Items.Add(New ListItem("Item1", "Item1"))
                DropDownList1.Items.Add(New ListItem("Item2", "Item2"))
                DropDownList1.Items.Add(New ListItem("Item2", "Item2"))
            End Sub
        </script>
    </head>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom DropDownList - BorderColor - VB.NET Example</h3>
            <aspSample:CustomDropDownListBorderColor id="DropDownList1" runat="server" />
        </form>
    </body>
</html>
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomDropDownListBorderColor : System.Web.UI.WebControls.DropDownList
    {
    [System.ComponentModel.Browsable(false)]
    public override System.Drawing.Color BorderColor
    {
      // NOTE: The BorderColor property is inherited from the WebControl 
      // class and is not applicable to the DropDownList control. 
      get
      {
        return base.BorderColor;
      }
      set
      {
        base.BorderColor = value;
      }
    }

    public override System.Web.UI.WebControls.BorderStyle BorderStyle
    {
      // NOTE: The BorderStyle property is inherited from the WebControl 
      // class and is not applicable to the DropDownList control. 
      get
      {
        return base.BorderStyle;
      }
      set
      {
        base.BorderStyle = value;
      }
    }

    public override System.Web.UI.WebControls.Unit BorderWidth
    {
      // NOTE: The BorderWidth property is inherited from the WebControl 
      // class and is not applicable to the DropDownList control. 
      get
      {
        return base.BorderWidth;
      }
      set
      {
        base.BorderWidth = value;
      }
    }

    public override string ToolTip
    {
      // NOTE: The ToolTip property is inherited from the WebControl 
      // class and is not applicable to the DropDownList control. 
      get
      {
        return base.ToolTip;
      }
      set
      {
        base.ToolTip = value;
      }
    }
  }
}
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public NotInheritable Class CustomDropDownListBorderColor
        Inherits System.Web.UI.WebControls.DropDownList

        Public Overrides Property BorderColor() As System.Drawing.Color
            ' NOTE: The BorderColor property is inherited from the WebControl 
            ' class and is not applicable to the DropDownList control. 
            Get
                Return MyBase.BorderColor
            End Get
            Set(ByVal Value As System.Drawing.Color)
                MyBase.BorderColor = Value
            End Set
        End Property

        Public Overrides Property BorderStyle() As System.Web.UI.WebControls.BorderStyle
            ' NOTE: The BorderStyle property is inherited from the WebControl 
            ' class and is not applicable to the DropDownList control. 
            Get
                Return MyBase.BorderStyle
            End Get
            Set(ByVal Value As System.Web.UI.WebControls.BorderStyle)
                MyBase.BorderStyle = Value
            End Set
        End Property

        Public Overrides Property BorderWidth() As System.Web.UI.WebControls.Unit
            ' NOTE: The BorderWidth property is inherited from the WebControl 
            ' class and is not applicable to the DropDownList control. 
            Get
                Return MyBase.BorderWidth
            End Get
            Set(ByVal Value As System.Web.UI.WebControls.Unit)
                MyBase.BorderWidth = Value
            End Set
        End Property

        Public Overrides Property ToolTip() As String
            ' NOTE: The ToolTip property is inherited from the WebControl 
            ' class and is not applicable to the DropDownList control. 
            Get
                Return MyBase.ToolTip
            End Get
            Set(ByVal Value As String)
                MyBase.ToolTip = Value
            End Set
        End Property
    End Class
End Namespace

설명

참고

BorderColor 속성에서 상속 되는 WebControl 클래스 및에 적용 되지 않습니다는 DropDownList 컨트롤.

적용 대상