SupportsPreviewControlAttributeとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SupportsPreviewControlAttributeの意味・解説 

SupportsPreviewControlAttribute クラス

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

コントロール デザイナデザイン時にコントロールプレビュー インスタンスが必要かどうか示します。このクラス継承できません。

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

<AttributeUsageAttribute(AttributeTargets.Class)> _
Public NotInheritable Class
 SupportsPreviewControlAttribute
    Inherits Attribute
Dim instance As SupportsPreviewControlAttribute
[AttributeUsageAttribute(AttributeTargets.Class)] 
public sealed class SupportsPreviewControlAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] 
public ref class SupportsPreviewControlAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */ 
public final class SupportsPreviewControlAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Class) 
public final class SupportsPreviewControlAttribute
 extends Attribute
解説解説

コントロール デザイナサポートされているプレビュー コントロールの型を示すには、SupportsPreviewControlAttribute 属性コントロール デザイナ クラス適用します。この属性は、関連付けられているコントロール実際に保持されているインスタンス影響与えことなくデザイン表示プレビュー コントロール変更するために使用します

通常、ControlDesigner クラスから派生したカスタム デザイナ クラス宣言するときにはSupportsPreviewControlAttribute指定しますSupportsPreviewControlAttribute 属性の SupportsPreviewControl プロパティの値によって、基本クラス ControlDesigner の UsePreviewControl メンバと ViewControl メンバ動作決まります

デザイナが、関連付けられたコントロール一時的なコピー使用してデザイン時の HTML生成することを示す場合は、SupportsPreviewControl プロパティtrue設定します一時コントロールへの変更保持されません。

デザイナで、ViewControl メソッドからコントロール インスタンス (特に Component プロパティ) を返すことを示す場合は、SupportsPreviewControl プロパティfalse設定しますコントロール オブジェクトへの変更保持されます。

たとえば CalendarDesigner クラスは、SupportsPreviewControlAttribute の値が true設定されマークされます。デザイナは、スタイル自動書式指定タスクプレビュー コントロール使用します。これによりユーザーは、カレンダー適用できるさまざまな自動フォーマット スタイルプレビュー実行できますユーザー異な自動フォーマット スタイルユーザー インターフェイス選択すると、選択したスタイルスキームプレビュー コントロール適用されます。新しいスタイルプレビュー コントロール適用しても、デザイナCalendar コントロールインスタンス適用されスキーム変更されません。

コントロール デザイナ宣言SupportsPreviewControlAttribute指定されていない場合ControlDesigner動作は、SupportsPreviewControlfalse指定することに相当します

メモメモ

ControlDesigner クラスから派生したデザイナ クラスは、UsePreviewControl メンバViewControl メンバオーバーライドし、SupportsPreviewControlAttribute 属性無視できますViewControlUsePreviewControl の必要とされる動作確認するには、派生したコントロール デザイナ クラスリファレンス ドキュメント参照してください

属性使用方法概要については、「属性概要」および「属性使用したメタデータ拡張」を参照してくださいデザイン時の属性詳細については、「属性デザインサポート」を参照してください

使用例使用例

SupportsPreviewControlAttribute 属性コントロール デザイナマークする方法次のコード例示します。このコード例では、Label クラスから ASP.NET サーバー コントロール派生しカスタム コントロール デザイナ実装関連付けます。コントロール デザイナ クラスの宣言は、SupportsPreviewControl 属性true設定してマークされます。コントロール デザイナは、GetDesignTimeHtml メソッドオーバーライドし、コントロールデザイン時の HTML斜体タグ囲みます

Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Web.UI
Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls
Imports System.Web.UI.WebControls
Imports System.Reflection

Namespace ControlDesignerSamples.VB

    ' Derive a simple Web control from Label to render a text string.
    ' Associate this control with the SimpleTextControlDesigner.
    <DesignerAttribute("ControlDesignerSamples.CS.SimpleTextControlDesigner"),
 _
    ToolboxData("<{0}:MyLabelControl Runat=""Server""><{0}:MyLabelControl>")>
 _
    Public Class MyLabelControl
        Inherits Label

        ' Use the Label control implementation, but associate
        ' the derived class with the custom control designer.
    End Class


    ' Mark the designer with the SupportsPreviewControlAttribute set
    ' to true.  This means the base.UsePreviewControl returns true,
    ' and base.ViewControl returns a temporary preview copy of the control.
    <SupportsPreviewControl(True)> _
    Public Class SimpleTextControlDesigner
        Inherits TextControlDesigner

        ' Override the base GetDesignTimeHtml method to display 
        ' the design time text in italics.
        Public Overrides Function
 GetDesignTimeHtml() As String
            Dim html As String
 = String.Empty

            Try
                ' Get the ViewControl for the associated control.
                Dim ctrl As Label = CType(ViewControl,
 Label)

                ' Set the default text, if necessary
                If ctrl.Text.Length = 0 Then
                    ctrl.Text = "Sample Text"
                End If

                ' Set the style to italic
                ctrl.Style.Add(HtmlTextWriterStyle.FontStyle, "italic")

                ' Let the base class create the HTML markup
                html = MyBase.GetDesignTimeHtml()
            Catch ex As Exception
                If String.IsNullOrEmpty(html)
 Then
                    ' Display the exception message
                    html = GetErrorDesignTimeHtml(ex)
                End If
            End Try

            Return html
        End Function

    End Class
End Namespace
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
using System.Web.UI.WebControls;
using System.Reflection;

namespace ControlDesignerSamples.CS
{
    // Define a simple designer associated with a 
    // simple text web control.
    
    // Mark the designer with the SupportsPreviewControlAttribute set
    // to true.  This means the base.UsePreviewControl returns true
,
    // and base.ViewControl returns a temporary preview copy of the
 control.
    [SupportsPreviewControl(true)]
    public class SimpleTextControlDesigner
 : TextControlDesigner
    {        
        // Override the base GetDesignTimeHtml method to display 
        // the design time text in italics.
        public override string GetDesignTimeHtml()
        {
            string html = String.Empty;
 
            try
            {
                // Initialize the return string to the default
                // design time html of the base TextControlDesigner.
                html = base.GetDesignTimeHtml();

                // Get the ViewControl for the associated control.
                Label ctrl = (Label)ViewControl;

                ctrl.Style.Add(HtmlTextWriterStyle.FontStyle, "Italic");
                html = base.GetDesignTimeHtml();

            }
            catch (System.Exception e)
            {
               if (String.IsNullOrEmpty(html))
               {
                   html = GetErrorDesignTimeHtml(e);
               }
            }
            
            return html;
        }

    }

    // Derive a simple Web control from Label to render a text string.
    // Associate this control with the SimpleTextControlDesigner.
    [DesignerAttribute("ControlDesignerSamples.CS.SimpleTextControlDesigner")
,
    ToolboxData("<{0}:MyLabelControl Runat=\"Server\"><{0}:MyLabelControl>")]
    public class MyLabelControl : Label
    {
        // Use the Label control implementation, but associate
        // the derived class with the custom control designer.
    }
}
継承階層継承階層
System.Object
   System.Attribute
    System.Web.UI.Design.SupportsPreviewControlAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SupportsPreviewControlAttribute メンバ
System.Web.UI.Design 名前空間
ControlDesigner.UsePreviewControl プロパティ
ControlDesigner.ViewControl プロパティ
PreviewControlDesigner
その他の技術情報
属性デザインサポート
Web フォームデザインサポート

SupportsPreviewControlAttribute コンストラクタ

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

SupportsPreviewControlAttribute クラス新しインスタンス初期化してSupportsPreviewControl プロパティ初期値設定します

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

Public Sub New ( _
    supportsPreviewControl As Boolean _
)
Dim supportsPreviewControl As Boolean

Dim instance As New SupportsPreviewControlAttribute(supportsPreviewControl)
public SupportsPreviewControlAttribute (
    bool supportsPreviewControl
)
public:
SupportsPreviewControlAttribute (
    bool supportsPreviewControl
)
public SupportsPreviewControlAttribute (
    boolean supportsPreviewControl
)
public function SupportsPreviewControlAttribute
 (
    supportsPreviewControl : boolean
)

パラメータ

supportsPreviewControl

SupportsPreviewControl に代入する初期値

解説解説

通常SupportsPreviewControlAttribute クラスインスタンス直接作成する要はありません。SupportsPreviewControlAttribute を、ソース コードカスタム コントロール デザイナクラス宣言適用します。

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SupportsPreviewControlAttribute クラス
SupportsPreviewControlAttribute メンバ
System.Web.UI.Design 名前空間

SupportsPreviewControlAttribute フィールド


パブリック フィールドパブリック フィールド

  名前 説明
パブリック フィールド Default プレビュー既定値設定された SupportsPreviewControlAttribute クラスインスタンス取得します。このフィールド読み取り専用です。
参照参照

関連項目

SupportsPreviewControlAttribute クラス
System.Web.UI.Design 名前空間
ControlDesigner.UsePreviewControl プロパティ
ControlDesigner.ViewControl プロパティ
PreviewControlDesigner

その他の技術情報

属性デザインサポート
Web フォームデザインサポート

SupportsPreviewControlAttribute プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

SupportsPreviewControlAttribute クラス
System.Web.UI.Design 名前空間
ControlDesigner.UsePreviewControl プロパティ
ControlDesigner.ViewControl プロパティ
PreviewControlDesigner

その他の技術情報

属性デザインサポート
Web フォームデザインサポート

SupportsPreviewControlAttribute メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals オーバーロードされますオーバーライドされます。  
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。 SupportsPreviewControlAttribute クラスのこのインスタンスハッシュ コード返します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute オーバーライドされますSupportsPreviewControlAttribute クラス現在のインスタンスプレビュー属性既定値設定されるかどうか示します
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SupportsPreviewControlAttribute クラス
System.Web.UI.Design 名前空間
ControlDesigner.UsePreviewControl プロパティ
ControlDesigner.ViewControl プロパティ
PreviewControlDesigner

その他の技術情報

属性デザインサポート
Web フォームデザインサポート

SupportsPreviewControlAttribute メンバ

コントロール デザイナデザイン時にコントロールプレビュー インスタンスが必要かどうか示します。このクラス継承できません。

SupportsPreviewControlAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド SupportsPreviewControlAttribute SupportsPreviewControlAttribute クラス新しインスタンス初期化して、SupportsPreviewControl プロパティ初期値設定します
パブリック フィールドパブリック フィールド
  名前 説明
パブリック フィールド Default プレビュー既定値設定されSupportsPreviewControlAttribute クラスインスタンス取得します。このフィールド読み取り専用です。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals オーバーロードされますオーバーライドされます。  
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされますSupportsPreviewControlAttribute クラスのこのインスタンスハッシュ コード返します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute オーバーライドされますSupportsPreviewControlAttribute クラス現在のインスタンスプレビュー属性既定値設定されるかどうか示します
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SupportsPreviewControlAttribute クラス
System.Web.UI.Design 名前空間
ControlDesigner.UsePreviewControl プロパティ
ControlDesigner.ViewControl プロパティ
PreviewControlDesigner

その他の技術情報

属性デザインサポート
Web フォームデザインサポート



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

辞書ショートカット

すべての辞書の索引

「SupportsPreviewControlAttribute」の関連用語

SupportsPreviewControlAttributeのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS