Aracılığıyla paylaş


LoginDesigner.GetDesignTimeHtml(DesignerRegionCollection) Yöntem

Tanım

Tasarım zamanında ilişkili denetimi işlemek için kullanılan işaretlemeyi alır ve tasarımcı bölgeleri koleksiyonunu doldurur.

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

Parametreler

regions
DesignerRegionCollection

Denetimin DesignerRegionCollection tasarım zamanı görünümünde seçilebilir ve tıklanabilir bölgelerin tanımlarının eklendiği a.

Döndürülenler

String

Tasarım zamanında işlemek için kullanılan işaretlemeyi Login içeren bir dize.

Örnekler

Aşağıdaki kod örneği, tasarım zamanında denetimden LoginDesigner türetilen Login bir denetimin görünümünü değiştirmek için sınıfından devralınan bir sınıfta yönteminin nasıl geçersiz kılındığını GetDesignTimeHtml gösterir. Örnek, denetimin özelliği veya değeriyseBorderStyle, kapsamını daha görünür hale getirmek için denetimin çevresine mavi, kesikli bir kenarlık çizerNotSet.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

Açıklamalar

yöntemi, GetDesignTimeHtml ilişkili denetimin LayoutTemplate özelliği için bir EditableDesignerRegion nesnesi oluşturur ve bunu parametresi tarafından başvuruda bulunan nesneye DesignerRegionCollection regions Login ekler. yöntemi, GetDesignTimeHtml denetimin GetDesignTimeHtml tasarım zamanı işlemesi Login için işaretleme oluşturmak üzere temel yöntemini kullanır.

Devralanlara Notlar

yöntemini geçersiz kılarsanız GetDesignTimeHtml(DesignerRegionCollection) , temel yöntemi çağırdığınızdan GetDesignTimeHtml() emin olun çünkü sonunda, birkaç geçersiz kılma düzeyi aracılığıyla, işaretlemeyi oluşturmak için denetimin Login bir kopyasını veya denetimi çağırır.

Şunlara uygulanır

Ayrıca bkz.