ConnectionStringEditor クラス

定義

デザイン時に接続文字列プロパティを選択および編集するためのユーザー インターフェイスの基本クラスを提供します。

public ref class ConnectionStringEditor : System::Drawing::Design::UITypeEditor
public class ConnectionStringEditor : System.Drawing.Design.UITypeEditor
type ConnectionStringEditor = class
    inherit UITypeEditor
Public Class ConnectionStringEditor
Inherits UITypeEditor
継承
ConnectionStringEditor
派生

次のコード例は、クラスの ConnectionStringEditor インスタンスをカスタム コントロール内に含まれるプロパティに関連付ける方法を示しています。 デザイン画面でコントロール プロパティを編集すると、 ConnectionStringEditor クラスは、プロパティ値の接続文字列を選択および編集するためのユーザー インターフェイスを提供します。

// Define a custom class derived from the SqlDataSource Web control. 
public class SqlDataSourceWithBackup : SqlDataSource
{
    private string _alternateConnectionString;

    // Define an alternate connection string, which could be used
    // as a fallback value if the primary connection string fails.
    
    // The EditorAttribute indicates the property can
    // be edited at design-time with the ConnectionStringEditor class.
    [
      DefaultValue(""),
      EditorAttribute(typeof(System.Web.UI.Design.ConnectionStringEditor),
                     typeof(System.Drawing.Design.UITypeEditor)),
      Category("Data"),
      Description("The alternate connection string.")
    ]
    public string AlternateConnectionString
    {
        get
        {
            return _alternateConnectionString;
        }
        set
        {
            _alternateConnectionString = value;
        }
    }
}
' Define a custom class derived from the SqlDataSource Web control. 
Public Class SqlDataSourceWithBackup
    Inherits SqlDataSource

    Private _alternateConnectionString As String

    ' Define an alternate connection string, which could be used
    ' as a fallback value if the primary connection string fails.

    ' The EditorAttribute indicates the property can
    ' be edited at design-time with the ConnectionStringEditor class.
    <DefaultValue(""), _
     EditorAttribute(GetType(System.Web.UI.Design.ConnectionStringEditor), _
         GetType(System.Drawing.Design.UITypeEditor)), _
     Category("Data"), _
     Description("The alternate connection string.")> _
   Public Property AlternateConnectionString() As String

        Get
            Return _alternateConnectionString
        End Get
        Set(ByVal value As String)
            _alternateConnectionString = value
        End Set
    End Property

End Class

注釈

クラスの ConnectionStringEditor インスタンスは、 UITypeEditor デザイン時に接続文字列式を選択および編集したり、式をコントロール プロパティに割り当てたりするために使用できるオブジェクトです。 たとえば、コントロールは SqlDataSource デザイン時にクラスを ConnectionStringEditor 使用してプロパティの値を ConnectionString 設定します。

属性を EditorAttribute 使用して、プロパティに ConnectionStringEditor 関連付けます。 関連付けられたプロパティがデザイン サーフェイスで編集されると、デザイナー ホストはメソッドを EditValue 呼び出します。 このメソッドは EditValue 、接続文字列式を作成するためのユーザー インターフェイスを表示し、ユーザーが選択した接続文字列を返します。 このメソッドは GetEditStyle 、ユーザー インターフェイスの表示スタイルを示します。

コンストラクター

ConnectionStringEditor()

ConnectionStringEditor クラスの新しいインスタンスを初期化します。

プロパティ

IsDropDownResizable

ユーザーがドロップダウン エディターのサイズを変更できるかどうかを示す値を取得します。

(継承元 UITypeEditor)

メソッド

EditValue(IServiceProvider, Object)

GetEditStyle() メソッドで提供されたエディター スタイルを使用して、指定したオブジェクトの値を編集します。

(継承元 UITypeEditor)
EditValue(ITypeDescriptorContext, IServiceProvider, Object)

指定したサービス プロバイダーおよびコンテキストを使用して、指定したオブジェクトの値を編集します。

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetEditStyle()

EditValue(IServiceProvider, Object) メソッドで使用するエディター スタイルを取得します。

(継承元 UITypeEditor)
GetEditStyle(ITypeDescriptorContext)

指定したコンテキストに対して接続文字列エディターに関連付けられている編集スタイルを返します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetPaintValueSupported()

エディターでオブジェクトの値の視覚的な表現を描画できるかどうかを示します。

(継承元 UITypeEditor)
GetPaintValueSupported(ITypeDescriptorContext)

指定したコンテキスト内でオブジェクトの値の視覚的な表現を描画できるかどうかを示します。

(継承元 UITypeEditor)
GetProviderName(Object)

ConnectionStringEditor クラスの指定されたインスタンスのプロバイダー名を返します。

GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
PaintValue(Object, Graphics, Rectangle)

指定したキャンバスに、指定したオブジェクトの値の視覚的な表現を描画します。

(継承元 UITypeEditor)
PaintValue(PaintValueEventArgs)

指定した PaintValueEventArgs を使用して、オブジェクトの値の視覚的な表現を描画します。

(継承元 UITypeEditor)
SetProviderName(Object, DesignerDataConnection)

ConnectionStringEditor クラスの指定したインスタンスにプロバイダー名を設定します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください