LoginDesigner クラスとは? わかりやすく解説

LoginDesigner クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

Login Web サーバー コントロールを、ビジュアルなデザイナデザイン時に使用できるようにします。

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

Public Class LoginDesigner
    Inherits CompositeControlDesigner
Dim instance As LoginDesigner
public class LoginDesigner : CompositeControlDesigner
public ref class LoginDesigner : public
 CompositeControlDesigner
public class LoginDesigner extends CompositeControlDesigner
public class LoginDesigner extends
 CompositeControlDesigner
解説解説

Login コントロールユーザー インターフェイス表示しますユーザーは、このユーザー インターフェイス使用してホストWeb サイトログオンできます

ビジュアルなデザイナソース ビューからデザイン ビュー切り替えると、Login コントロール記述するマークアップソース コード解析されコントロールデザインバージョンデザイン サーフェイス作成されます。元のソース ビュー切り替えると、デザインコントロールマークアップソース コード永続化され、Web ページマークアップ反映されます。LoginDesigner クラスは、Login コントロールデザイン時に使用できるようにします。

LoginDesigner クラスプロパティは、次の機能提供します

LoginDesigner クラスメソッドは、次の機能提供します

使用例使用例

LoginDesigner クラス拡張しLogin コントロールか派生したコントロール外観デザイン時に変更するコード例次に示します

この例では、MyLogin コントロールLogin から派生させています。MyLogin は、Login コントロールコピーです。また、この例では、MyLoginDesigner クラスLoginDesigner から派生させ、MyLoginDesigner の DesignerAttribute 属性MyLogin コントロール適用してます。

MyLoginDesigner は、PreFilterProperties メソッドオーバーライドし、デザイン時に、[プロパティ] グリッドNamingContainer プロパティ表示しますMyLogin コントロールの BorderStyle プロパティの値が NotSet または None の場合GetDesignTimeHtml メソッドオーバーライドし、コントロール周囲に青い点線境界線描画して、コントロール範囲わかりやすくしています。GetErrorDesignTimeHtml メソッドオーバーライドして、赤の太字表示されるエラー メッセージ含んだプレースホルダのマークアップ生成してます。

Imports System
Imports System.Web
Imports System.Drawing
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Collections
Imports System.ComponentModel
Imports System.Security.Permissions

Namespace Examples.VB.WebControls.Design

    ' The MyLogin is a copy of the Login.
    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <Designer(GetType(Examples.VB.WebControls.Design.MyLoginDesigner))>
 _
    Public Class MyLogin
        Inherits Login
    End Class ' MyLogin

    ' Override members of the LoginDesigner.
    <ReflectionPermission(SecurityAction.Demand, Flags:=ReflectionPermissionFlag.MemberAccess)>
 _
    Public Class MyLoginDesigner
        Inherits LoginDesigner

        ' Generate the design-time markup for the control when an error
 occurs.
        Protected Overrides Function
 GetErrorDesignTimeHtml( _
            ByVal ex As Exception) As
 String

            ' Write the error message text in red, bold.
            Dim errorRendering As String
 = _
                "<span style=""font-weight:bold;
 color:Red; "">" & _
                ex.Message & "</span>"

            Return CreatePlaceHolderDesignTimeHtml(errorRendering)

        End Function ' GetErrorDesignTimeHtml

        ' Shadow the control properties with design-time properties.
        Protected Overrides Sub
 PreFilterProperties( _
            ByVal properties As IDictionary)

            ' Call the base method first.
            MyBase.PreFilterProperties(properties)

            ' Make the NamingContainer visible in the Properties grid.
            Dim selectProp As PropertyDescriptor
 = _
                CType(properties("NamingContainer"),
 PropertyDescriptor)
            properties("NamingContainer") = _
                TypeDescriptor.CreateProperty(selectProp.ComponentType, _
                    selectProp, BrowsableAttribute.Yes)
        End Sub ' PreFilterProperties

        ' 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
    End Class ' MyLoginDesigner
End Namespace ' Examples.VB.WebControls.Design
using System;
using System.Web;
using System.Drawing;
using System.Web.UI.WebControls;
using System.Web.UI.Design.WebControls;
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;

namespace Examples.CS.WebControls.Design
{
    // The MyLogin is a copy of the Login.
    [AspNetHostingPermission(SecurityAction.Demand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [Designer(typeof(Examples.CS.WebControls.Design.MyLoginDesigner))]
    public class MyLogin : Login
    {
    } // MyLogin

    // Override members of the LoginDesigner.
    [ReflectionPermission(SecurityAction.Demand, Flags=ReflectionPermissionFlag.MemberAccess)]
    public class MyLoginDesigner : LoginDesigner
    {
        // Generate the design-time markup for the control when an error
 occurs.
        protected override string GetErrorDesignTimeHtml(Exception
 e) 
        {
            // Write the error message text in red, bold.
            string errorRendering =
                "<span style=\"font-weight:bold; color:Red; \">"
 +
                e.Message + "</span>";

            return CreatePlaceHolderDesignTimeHtml(errorRendering);
        } // GetErrorDesignTimeHtml

        // Shadow the control properties with design-time properties.
        protected override void PreFilterProperties(IDictionary
 properties)
        {
            // Call the base method first.
            base.PreFilterProperties(properties);

            // Make the NamingContainer visible in the Properties grid.
            PropertyDescriptor selectProp = 
                (PropertyDescriptor)properties["NamingContainer"];
            properties["NamingContainer"] =
                TypeDescriptor.CreateProperty(selectProp.ComponentType, 
                    selectProp, BrowsableAttribute.Yes);
        } // PreFilterProperties

        // 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
    } // MyLoginDesigner
} // Examples.CS.WebControls.Design
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.ComponentModel.Design.ComponentDesigner
     System.Web.UI.Design.HtmlControlDesigner
       System.Web.UI.Design.ControlDesigner
         System.Web.UI.Design.WebControls.CompositeControlDesigner
          System.Web.UI.Design.WebControls.LoginDesigner
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「LoginDesigner クラス」の関連用語

LoginDesigner クラスのお隣キーワード
検索ランキング

   

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



LoginDesigner クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS