HtmlTextWriter.EnterStyle 메서드

정의

지정한 스타일의 레이아웃 및 문자 서식을 구현하는 특성이 포함된 태그 요소의 여는 태그를 씁니다.

오버로드

Name Description
EnterStyle(Style)

지정된 스타일의 레이아웃 및 문자 서식을 <span> 구현하는 특성이 포함된 요소의 여는 태그를 씁니다.

EnterStyle(Style, HtmlTextWriterTag)

지정한 스타일의 레이아웃 및 문자 서식을 구현하는 특성이 포함된 태그 요소의 여는 태그를 씁니다.

EnterStyle(Style)

지정된 스타일의 레이아웃 및 문자 서식을 <span> 구현하는 특성이 포함된 요소의 여는 태그를 씁니다.

public:
 virtual void EnterStyle(System::Web::UI::WebControls::Style ^ style);
public virtual void EnterStyle(System.Web.UI.WebControls.Style style);
abstract member EnterStyle : System.Web.UI.WebControls.Style -> unit
override this.EnterStyle : System.Web.UI.WebControls.Style -> unit
Public Overridable Sub EnterStyle (style As Style)

매개 변수

style
Style

Style 태그 블록에 적용하기 시작할 레이아웃 및 서식을 지정하는 A입니다.

예제

다음 코드 예제에서는 클래스에서 TextSample 파생 된 명명 WebControl된 사용자 지정 클래스를 사용 하는 방법을 보여 줍니다. 이 메서드를 사용 하 여 EnterStyle 텍스트 문자열에 스타일을 적용 ForeColor 합니다.

이 메서드는 EnterStyle HTML <span style="color:Navy;">을 렌더링합니다. 메서드 호출은 ExitStyle 텍스트가 <span> 렌더링된 후 요소를 닫습니다.

Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Security.Permissions
Imports System.Drawing

' Create a custom class, named TextSample, that renders
' its Text property with styles applied by the
' EnterStyle and ExitStyle methods. 
Namespace AspNet.Samples

    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public Class TextSample
        Inherits Control

        ' Create an instance of the Style class.
        Private textStyle As Style = New Style()
        Private textMessage As String

        ' Create a Text property.
        Public Property Text() As String
            Get
                Return textMessage
            End Get
            Set(ByVal value As String)
                textMessage = value
            End Set
        End Property


        Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
            ' Set the value of the Text property.
            textMessage = "Hello, World!"

            ' Set the Style object's ForeColor
            ' property to Navy.
            textStyle.ForeColor = Color.Navy

            ' Render the Text property with the style.
            writer.WriteLine("The text property styled: ")
            writer.EnterStyle(textStyle)
            writer.Write(Text)
            writer.ExitStyle(textStyle)

            ' Use the WriteBreak method twice to render
            ' an empty line between the lines of rendered text.
            writer.WriteBreak()
            writer.WriteBreak()

            ' Render the Text property without the style.
            writer.WriteLine("The Text property unstyled: ")
            writer.Write(Text)
        End Sub
    End Class
End Namespace

설명

이 메서드를 EnterStyle 사용하여 배경색 또는 테두리 너비와 같은 스타일을 태그 블록에 적용할 수 있습니다.

EnterStyleExitStyle 메서드를 사용하면 디바이스 어댑터 또는 컨트롤이 지정된 스타일의 문자 서식을 사용하는 태그를 만들 수 있습니다. 해당 style 메서드에서 EnterStyle 사용하는 메서드에 대해 동일한 값을 ExitStyle 사용합니다.

EnterStyle 메서드의 EnterStyle(Style) 오버로드는 요소의 여는 태그를 <span> 렌더링합니다. 그런 다음 이 메서드는 필요한 특성 및 스타일 특성을 요소의 <span> 여는 태그에 추가하여 개체에 지정된 Style 설정을 표시합니다. 특성 및 스타일 특성을 포함하도록 다른 태그 요소를 렌더링하려면 오버로드를 EnterStyle(Style, HtmlTextWriterTag) 사용합니다.

추가 정보

적용 대상

EnterStyle(Style, HtmlTextWriterTag)

지정한 스타일의 레이아웃 및 문자 서식을 구현하는 특성이 포함된 태그 요소의 여는 태그를 씁니다.

public:
 virtual void EnterStyle(System::Web::UI::WebControls::Style ^ style, System::Web::UI::HtmlTextWriterTag tag);
public virtual void EnterStyle(System.Web.UI.WebControls.Style style, System.Web.UI.HtmlTextWriterTag tag);
abstract member EnterStyle : System.Web.UI.WebControls.Style * System.Web.UI.HtmlTextWriterTag -> unit
override this.EnterStyle : System.Web.UI.WebControls.Style * System.Web.UI.HtmlTextWriterTag -> unit
Public Overridable Sub EnterStyle (style As Style, tag As HtmlTextWriterTag)

매개 변수

style
Style

Style 태그 블록에 적용하기 시작할 레이아웃 및 서식을 지정하는 A입니다.

tag
HtmlTextWriterTag

HtmlTextWriterTag 에 지정된 스타일 개체를 포함할 태그 요소의 여는 style태그를 지정하는 형식입니다.

예제

다음 코드 예제에서는 클래스에서 TextSample 파생 된 명명 WebControl된 사용자 지정 클래스를 사용 하는 방법을 보여 줍니다. 이 메서드를 사용 하 여 EnterStyle 텍스트 문자열에 스타일을 적용 ForeColor 합니다.

이 메서드는 EnterStyle HTML <span style="color:Navy;">을 렌더링합니다. 메서드 호출은 ExitStyle 텍스트가 <span> 렌더링된 후 요소를 닫습니다.

Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Security.Permissions
Imports System.Drawing

' Create a custom class, named TextSample, that renders
' its Text property with styles applied by the
' EnterStyle and ExitStyle methods. 
Namespace AspNet.Samples

    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public Class TextSample
        Inherits Control

        ' Create an instance of the Style class.
        Private textStyle As Style = New Style()
        Private textMessage As String

        ' Create a Text property.
        Public Property Text() As String
            Get
                Return textMessage
            End Get
            Set(ByVal value As String)
                textMessage = value
            End Set
        End Property


        Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
            ' Set the value of the Text property.
            textMessage = "Hello, World!"

            ' Set the Style object's ForeColor
            ' property to Navy.
            textStyle.ForeColor = Color.Navy

            ' Render the Text property with the style.
            writer.WriteLine("The text property styled: ")
            writer.EnterStyle(textStyle)
            writer.Write(Text)
            writer.ExitStyle(textStyle)

            ' Use the WriteBreak method twice to render
            ' an empty line between the lines of rendered text.
            writer.WriteBreak()
            writer.WriteBreak()

            ' Render the Text property without the style.
            writer.WriteLine("The Text property unstyled: ")
            writer.Write(Text)
        End Sub
    End Class
End Namespace

설명

이 메서드를 EnterStyle 사용하여 배경색 또는 테두리 너비와 같은 스타일을 태그 블록에 적용할 수 있습니다.

EnterStyleExitStyle 메서드를 사용하면 디바이스 어댑터 또는 컨트롤이 지정된 스타일의 문자 서식을 사용하는 태그를 만들 수 있습니다. 해당 style 메서드에서 EnterStyle 사용하는 메서드에 대해 동일한 값을 ExitStyle 사용합니다.

EnterStyle 메서드의 EnterStyle(Style, HtmlTextWriterTag) 오버로드는 매개 변수로 지정된 요소의 여는 태그를 tag 렌더링합니다. 그런 다음, 메서드는 EnterStyle(Style, HtmlTextWriterTag) 요소의 여는 태그에 필요한 특성 및 스타일 특성을 추가하여 개체에 지정된 Style 설정을 표시합니다. 오버로드를 EnterStyle(Style) 사용하여 요소의 여는 태그를 렌더링합니다 <span> .

추가 정보

적용 대상