다음을 통해 공유


LoginDesigner.GetDesignTimeHtml(DesignerRegionCollection) 메서드

정의

디자인 타임에, 연결된 컨트롤을 렌더링하는 데 사용되는 태그를 가져와서 디자이너 영역의 컬렉션을 채웁니다.

public:
 override System::String ^ GetDesignTimeHtml(System::Web::UI::Design::DesignerRegionCollection ^ regions);
public override string GetDesignTimeHtml (System.Web.UI.Design.DesignerRegionCollection regions);
override this.GetDesignTimeHtml : System.Web.UI.Design.DesignerRegionCollection -> string
Public Overrides Function GetDesignTimeHtml (regions As DesignerRegionCollection) As String

매개 변수

regions
DesignerRegionCollection

컨트롤의 디자인 타임 보기에서 선택 및 클릭할 수 있는 영역의 정의가 추가되는 DesignerRegionCollection입니다.

반환

String

디자인 타임에 Login를 렌더링하는 데 사용되는 태그를 포함한 문자열입니다.

예제

다음 코드 예제에서는 재정의 하는 방법을 보여 줍니다.는 GetDesignTimeHtml 에서 상속 된 클래스에서 메서드를 LoginDesigner 클래스에서 파생 된 컨트롤의 모양을 변경 하는 Login 디자인 타임에 컨트롤입니다. 예제 인 경우 파란색, 파선의 범위가 더 잘 표시 되도록 컨트롤 테두리를 그립니다 합니다 BorderStyle 컨트롤의 속성이 합니다 NotSet 또는 None 값입니다.

// Generate the design-time markup.
public override string GetDesignTimeHtml()
{
    // Make the control more visible in the designer.  If the border 
    // style is None or NotSet, change the border to a blue dashed line. 
    MyLogin myLoginCtl = (MyLogin)ViewControl;
    string markup = null;

    // Check if the border style should be changed.
    if (myLoginCtl.BorderStyle == BorderStyle.NotSet ||
        myLoginCtl.BorderStyle == BorderStyle.None)
    {
        BorderStyle oldBorderStyle = myLoginCtl.BorderStyle;
        Color oldBorderColor = myLoginCtl.BorderColor;

        // Set the design time properties and catch any exceptions.
        try
        {
            myLoginCtl.BorderStyle = BorderStyle.Dashed;
            myLoginCtl.BorderColor = Color.Blue;

            // Call the base method to generate the markup.
            markup = base.GetDesignTimeHtml();
        }
        catch (Exception ex)
        {
            markup = GetErrorDesignTimeHtml(ex);
        }
        finally
        {
            // It is not necessary to restore the border properties 
            // to their original values because the ViewControl 
            // was used to reference the associated control and the 
            // UsePreviewControl was not overridden.  

            // myLoginCtl.BorderStyle = oldBorderStyle;
            // myLoginCtl.BorderColor = oldBorderColor;
        }
    }
    else
    {
        // Call the base method to generate the markup.
        markup = base.GetDesignTimeHtml();
    }

    return markup;
} // GetDesignTimeHtml
' Generate the design-time markup.
Public Overrides Function GetDesignTimeHtml() As String

    ' Make the control more visible in the designer.  If the border 
    ' style is None or NotSet, change the border to a blue dashed line. 
    Dim myLoginCtl As MyLogin = CType(ViewControl, MyLogin)
    Dim markup As String = Nothing

    ' Check if the border style should be changed.
    If (myLoginCtl.BorderStyle = BorderStyle.NotSet Or _
        myLoginCtl.BorderStyle = BorderStyle.None) Then

        Dim oldBorderStyle As BorderStyle = myLoginCtl.BorderStyle
        Dim oldBorderColor As Color = myLoginCtl.BorderColor

        ' Set the design time properties and catch any exceptions.
        Try
            myLoginCtl.BorderStyle = BorderStyle.Dashed
            myLoginCtl.BorderColor = Color.Blue

            ' Call the base method to generate the markup.
            markup = MyBase.GetDesignTimeHtml()

        Catch ex As Exception
            markup = GetErrorDesignTimeHtml(ex)

        Finally
            ' It is not necessary to restore the border properties 
            ' to their original values because the ViewControl 
            ' was used to reference the associated control and the 
            ' UsePreviewControl was not overridden.  

            ' myLoginCtl.BorderStyle = oldBorderStyle
            ' myLoginCtl.BorderColor = oldBorderColor
        End Try

    Else
        ' Call the base method to generate the markup.
        markup = MyBase.GetDesignTimeHtml()
    End If

    Return markup

End Function ' GetDesignTimeHtml

설명

GetDesignTimeHtml 메서드를 만듭니다는 EditableDesignerRegion 개체에 대 한를 LayoutTemplate 속성은 연결 된 Login 제어에 추가 합니다를 DesignerRegionCollection 에서 참조 되는 개체는 regions 매개 변수입니다. 합니다 GetDesignTimeHtml 메서드를 GetDesignTimeHtml 기본 디자인 타임 렌더링에 대 한 태그를 생성 하는 메서드는 Login 제어 합니다.

상속자 참고

재정의 하는 경우는 GetDesignTimeHtml(DesignerRegionCollection) 메서드를 호출 해야 합니다 GetDesignTimeHtml() 기본 결국은 여러 재정의 않으므로 수준에서 메서드 호출을 Login 컨트롤이 나 태그를 생성 하는 컨트롤의 복사본을.

적용 대상

추가 정보