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

CheckBoxDesigner クラス

CheckBox Web サーバー コントロールデザイン時の動作拡張します。

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

Public Class CheckBoxDesigner
    Inherits ControlDesigner
Dim instance As CheckBoxDesigner
public class CheckBoxDesigner : ControlDesigner
public ref class CheckBoxDesigner : public
 ControlDesigner
public class CheckBoxDesigner extends ControlDesigner
public class CheckBoxDesigner extends
 ControlDesigner
解説解説

CheckBoxDesigner クラスは、ControlDesigner クラスの GetDesignTimeHtml メソッドオーバーライドして、デザイン時にコントロールわかりやすく表示されるようにします。Text プロパティが空の場合、このクラスGetDesignTimeHtml メソッドは、コントロールText プロパティを、そのコントロールの Control.ID プロパティ設定します

使用例使用例

SampleCheckBoxDesigner という名前のカスタム デザイナ クラスCheckBoxDesigner クラスから継承して作成するコード例次に示します。このカスタム クラスGetDesignTimeHtml メソッドオーバーライドます。CheckBox.Text プロパティ設定済みない場合は、このメソッド呼び出すと、プロパティに文字列が設定されデザイン サーフェイスにその文字列表示されます。Text プロパティに値が既に設定されている場合は、その値が表示されます。

Imports System
'Imports System.Design
Imports System.Drawing
Imports System.ComponentModel
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls
'Imports Examples.AspNet

Namespace Examples.AspNet '.Design

    ' Create a class, named SampleCheckBoxDesigner, that overrides the
    ' GetDesignTimeHtml method to display the control on the design
    ' surface.

    Public Class SampleCheckBoxDesigner
        Inherits System.Web.UI.Design.WebControls.CheckBoxDesigner

        ' Override the GetDesignTimeHtml method to display a border
 on the 
        ' control if the BorderStyle property has not been set by the
 user.
        Public Overrides Function
 GetDesignTimeHtml() As String

            Dim sampleCheckBox As SampleCheckBox
 = CType(Component, _
                SampleCheckBox)
            Dim designTimeHtml As String
 = Nothing

            ' Check the control's BorderStyle property.
            If (sampleCheckBox.BorderStyle = BorderStyle.NotSet)
 Then

                ' Save the current value of the BorderStyle property.
                Dim oldBorderStyle As BorderStyle
 = _
                    sampleCheckBox.BorderStyle

                ' Change the value of the BorderStyle property and 
                ' generate the design-time HTML.
                Try
                    sampleCheckBox.BorderStyle = BorderStyle.Groove
                    designTimeHtml = MyBase.GetDesignTimeHtml()

                    ' If an exception occurs, call the GetErrorDesignTimeHtml
                    ' method.
                Catch ex As Exception
                    designTimeHtml = GetErrorDesignTimeHtml(ex)

                    ' Restore the BorderStyle property to its original
 value.
                Finally
                    sampleCheckBox.BorderStyle = oldBorderStyle
                End Try

            Else
                designTimeHtml = MyBase.GetDesignTimeHtml()
            End If

            Return designTimeHtml
        End Function
    End Class
End Namespace

SampleCheckBox という名前の単純なクラスCheckBox クラスから継承して作成するコード例次に示します。このクラスは、DesignerAttribute クラスにより SampleCheckBoxDesigner クラス関連付けられます。

Namespace Examples.AspNet

    ' The SampleCheckBox class that uses the SampleCheckBoxDesigner
 class.
    <Designer(GetType( _
        Examples.AspNet.SampleCheckBoxDesigner))> _
    Public Class SampleCheckBox
        Inherits CheckBox
        ' To customize the CheckBox class, insert code here.
    End Class

End Namespace
継承階層継承階層
System.Object
   System.ComponentModel.Design.ComponentDesigner
     System.Web.UI.Design.HtmlControlDesigner
       System.Web.UI.Design.ControlDesigner
        System.Web.UI.Design.WebControls.CheckBoxDesigner
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「CheckBoxDesigner クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS