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

LoginStatusDesigner クラス

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

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

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

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

LoginStatus コントロールは、ユーザー認証ステータス自動的に確認するボタン表示し必要なログインまたはログアウトオプション表示します

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

ActionLists プロパティは、DesignerActionListCollection オブジェクト返します一般にこのオブジェクトには、デザイナ継承ツリーの各レベルについて、DesignerActionList クラスから派生したオブジェクト格納されます。UsePreviewControl プロパティは、常に true返しますデザイン時にはユーザー認証ステータス利用できないため、デザイナは、関連付けられた LoginStatus一時的なコピー作成してデザイン時のマークアップ生成します

GetDesignTimeHtml メソッドは、デザイン時に関連付けられた LoginStatusレンダリング使用するマークアップ返しますInitialize メソッドは、関連付けられた LoginStatusデザイナ表示編集デザインできるように準備します

使用例使用例

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

この例では、MyLoginStatus コントロールLoginStatus から派生させています。MyLoginStatus は、LoginStatus コントロールコピーです。また、この例では、MyLoginStatusDesigner クラスLoginStatusDesigner から派生させ、この MyLoginStatusDesigner指定した DesignerAttribute 属性MyLoginStatus コントロール適用します。

MyLoginStatus の BorderStyle プロパティ値が NotSet または None の場合 MyLoginStatusDesigner は、GetDesignTimeHtml メソッドオーバーライドして、コントロール範囲わかりやすくする青い破線境界線周囲描画ます。

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 MyLoginStatus is a copy of the LoginStatus.
    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <Designer(GetType(Examples.VB.WebControls.Design.MyLoginStatusDesigner))>
 _
    Public Class MyLoginStatus
        Inherits LoginStatus
    End Class ' MyLoginStatus

    ' Override members of the LoginStatusDesigner.
    Public Class MyLoginStatusDesigner
        Inherits LoginStatusDesigner

        ' 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 myLoginStatusCtl As MyLoginStatus
 = _
                CType(ViewControl, MyLoginStatus)
            Dim markup As String
 = Nothing

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

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

                ' Set the design time properties and catch any exceptions.
                Try
                    myLoginStatusCtl.BorderStyle = BorderStyle.Dashed
                    myLoginStatusCtl.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 ' MyLoginStatusDesigner
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;
using System.IO;

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

    // Override members of the LoginStatusDesigner.
    public class MyLoginStatusDesigner : LoginStatusDesigner
    {
        // 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. 
            MyLoginStatus myLoginStatusCtl = (MyLoginStatus)ViewControl;
            string markup = null;

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

                // Set the design time properties and catch any exceptions.
                try
                {
                    myLoginStatusCtl.BorderStyle = BorderStyle.Dashed;
                    myLoginStatusCtl.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
    } // MyLoginStatusDesigner
} // Examples.CS.WebControls.Design
継承階層継承階層
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.LoginStatusDesigner
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LoginStatusDesigner メンバ
System.Web.UI.Design.WebControls 名前空間
LoginStatus
CompositeControl
WebControl
CompositeControlDesigner クラス
ControlDesigner クラス
HtmlControlDesigner クラス
ComponentDesigner
その他の技術情報
ASP.NET コントロール デザイナ概要
チュートリアル : Web サーバー コントロール用の基本的なコントロール デザイナ作成



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

辞書ショートカット

すべての辞書の索引

「LoginStatusDesigner クラス」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS