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

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

BaseValidatorDesigner クラス

BaseValidator クラスから派生した Web サーバー コントロールを、ビジュアル デザイナで、デザイン時に使用できるようにします。

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

Public Class BaseValidatorDesigner
    Inherits PreviewControlDesigner
Dim instance As BaseValidatorDesigner
public class BaseValidatorDesigner : PreviewControlDesigner
public ref class BaseValidatorDesigner : public
 PreviewControlDesigner
public class BaseValidatorDesigner extends
 PreviewControlDesigner
public class BaseValidatorDesigner extends
 PreviewControlDesigner
解説解説
使用例使用例

CompareValidator クラスから SimpleCompareValidator コントロール派生する例を次に示しますSimpleCompareValidatorCompareValidatorコピーです。この例では、さらに、BaseValidatorDesigner クラスから SimpleCompareValidatorDesigner クラス派生し、DesignerAttribute 属性使用してSimpleCompareValidatorDesigner クラスSimpleCompareValidator コントロール関連付けています。

SimpleCompareValidatorDesigner は、GetDesignTimeHtml メソッドオーバーライドして、SimpleCompareValidator コントロールの BorderStyle プロパティの値が NotSet フィールドまたは None フィールドである場合実線境界線コントロール周囲描画ます。

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

Namespace Examples.VB.WebControls.Design

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

    ' Derive a designer that inherits from the BaseValidatorDesigner.
    Public Class SimpleCompareValidatorDesigner
        Inherits BaseValidatorDesigner

        ' Make the full extent of the control more visible in the designer.
        ' If the border style is None or NotSet, change the border to
 a 
        ' solid line. 
        Public Overrides Function
 GetDesignTimeHtml() As String

            ' Get a reference to the control or a copy of the control.
            Dim myCV As SimpleCompareValidator
 = _
                CType(ViewControl, SimpleCompareValidator)
            Dim markup As String

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

                ' Save the current property setting.
                Dim oldBorderStyle As BorderStyle
 = myCV.BorderStyle

                ' Set the design-time property and catch any exceptions.
                Try
                    myCV.BorderStyle = BorderStyle.Solid

                    ' Call the base method to generate the markup.
                    markup = MyBase.GetDesignTimeHtml()

                Catch ex As Exception
                    markup = GetErrorDesignTimeHtml(ex)

                Finally
                    ' Restore the property to its original setting.
                    myCV.BorderStyle = oldBorderStyle
                End Try

            Else
                ' Call the base method to generate the markup.
                markup = MyBase.GetDesignTimeHtml()
            End If

            Return markup
        End Function
    End Class ' SimpleCompareValidatorDesigner
End Namespace ' Examples.VB.WebControls.Design
using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.Design.WebControls;
using System.ComponentModel;
using System.Security.Permissions;

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

    // Derive a designer that inherits from the BaseValidatorDesigner.
    public class SimpleCompareValidatorDesigner
 : BaseValidatorDesigner
    {
        // Make the full extent of the control more visible in the designer.
        // If the border style is None or NotSet, change the border
 to a 
        // solid line. 
        public override string GetDesignTimeHtml()
        {
            // Get a reference to the control or a copy of the control.
            SimpleCompareValidator myCV = (SimpleCompareValidator)ViewControl;
            string markup = null;

            // Check if the border style should be changed.
            if (myCV.BorderStyle == BorderStyle.NotSet ||
                myCV.BorderStyle == BorderStyle.None)
            {
                // Save the current property setting.
                BorderStyle oldBorderStyle = myCV.BorderStyle;

                // Set the design-time property and catch any exceptions.
                try
                {
                    myCV.BorderStyle = BorderStyle.Solid;

                    // Call the base method to generate the markup.
                    markup = base.GetDesignTimeHtml();
                }
                catch (Exception ex)
                {
                    markup = GetErrorDesignTimeHtml(ex);
                }
                finally
                {
                    // Restore the property to its original setting.
                    myCV.BorderStyle = oldBorderStyle;
                }
            }
            else
                // Call the base method to generate the markup.
                markup = base.GetDesignTimeHtml();

            return markup;

        } // GetDesignTimeHtml
    } // SimpleCompareValidatorDesigner
} // 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.PreviewControlDesigner
          System.Web.UI.Design.WebControls.BaseValidatorDesigner
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「BaseValidatorDesigner クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS