MdbDataFileEditor 클래스

정의

Microsoft Access 데이터베이스 파일을 선택하기 위한 디자인 타임 사용자 인터페이스를 제공합니다.

public ref class MdbDataFileEditor : System::Web::UI::Design::UrlEditor
public class MdbDataFileEditor : System.Web.UI.Design.UrlEditor
type MdbDataFileEditor = class
    inherit UrlEditor
Public Class MdbDataFileEditor
Inherits UrlEditor
상속
MdbDataFileEditor

예제

다음 코드 예제에는 인스턴스에 연결 하는 방법을 보여 줍니다.는 MdbDataFileEditor 사용자 지정 컨트롤에 포함 된 속성이 있는 클래스입니다. 디자인 화면에서 컨트롤 속성을 편집 하는 경우는 MdbDataFileEditor 클래스는 선택한 속성 값에 대 한 액세스 데이터베이스 파일 이름을 편집 하는 사용자 인터페이스를 제공 합니다.

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.IO;

namespace ControlDesignerSamples.CS
{
    // Define a simple text control, derived from the 
    // System.Web.UI.WebControls.Label class.
    [
        Designer(typeof(TextControlDesigner))
    ]
    public class SimpleTextControl : Label
    {
        // Define a private member to store the file name value in the control.
        private string _filename = "";
        private string _internalText = "";

        // Define the public MDB data file name property.  Indicate that the
        // property can be edited at design-time with the MdbDataFileEditor class.
        [EditorAttribute(typeof(System.Web.UI.Design.MdbDataFileEditor), 
                         typeof(System.Drawing.Design.UITypeEditor))]
        public string MdbFileName
        {
            get
            {
                return _filename;
            }
            set
            {
                _filename = value;
            }
        }

        // Define a property that returns the timestamp
        // for the selected file.
        public string LastChanged
        {
            get
            {
                if ((_filename != null) && (_filename.Length > 0))
                {
                    if (File.Exists(_filename))
                    {
                        DateTime lastChangedStamp = File.GetLastWriteTime(_filename);
                        return lastChangedStamp.ToLongDateString();
                    }
                }
                return "";
            }
        }

        // Override the control Text property, setting the default
        // text to the LastChanged string value for the selected
        // file name.  If the file name has not been set in the
        // design view, then default to an empty string.
        public override string Text
        {
            get
            {
                if ((_internalText == "") && (LastChanged.Length > 0))
                {
                    // If the internally stored value hasn't been set,
                    // and the file name property has been set,
                    // return the last changed timestamp for the file.
                    _internalText = LastChanged;
                } 
                return _internalText;
            }

            set
            {
                if ((value != null) && (value.Length > 0))
                {
                    _internalText = value;
                }
                else {
                    _internalText = "";
                }
            }
        }
    }
}

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.IO

Namespace ControlDesignerSamples.VB


    ' Define a simple text control, derived from the 
    ' System.Web.UI.WebControls.Label class.

    <Designer(GetType(TextControlDesigner))> _
    Public Class SimpleTextControl
        Inherits Label

        ' Define a private member to store the file name value in the control.
        Private _filename As String = ""
        Private _internalText As String = ""

        ' Define the public MDB data file name property.  Indicate that the
        ' property can be edited at design-time with the MdbDataFileEditor class.
        <EditorAttribute(GetType(System.Web.UI.Design.MdbDataFileEditor), _
                         GetType(System.Drawing.Design.UITypeEditor))> _
        Public Property MdbFileName() As String
            Get
                Return _filename
            End Get

            Set(ByVal value As String)
                _filename = value
            End Set
        End Property

        ' Define a property that returns the timestamp
        ' for the selected file.
        Public ReadOnly Property LastChanged() As String
            Get
                If Not _filename Is Nothing AndAlso _filename.Length > 0 Then
                    If File.Exists(_filename) Then
                        Dim lastChangedStamp As DateTime
                        lastChangedStamp = File.GetLastWriteTime(_filename)
                        Return lastChangedStamp.ToLongDateString()
                    End If
                End If

                Return String.Empty

            End Get

        End Property

        ' Override the control Text property, setting the default
        ' text to the LastChanged string value for the selected
        ' file name.  If the file name has not been set in the
        ' design view, then default to an empty string.
        Public Overrides Property Text() As String
            Get
                If _internalText.Length = 0 And LastChanged.Length > 0 Then
                    ' If the internally stored value hasn't been set,
                    ' and the file name property has been set,
                    ' return the last changed timestamp for the file.

                    _internalText = LastChanged
                End If
                Return _internalText
            End Get

            Set(ByVal value As String)
                If Not value Is Nothing AndAlso value.Length > 0 Then
                    _internalText = value
                Else
                    _internalText = String.Empty
                End If

            End Set
        End Property

    End Class
End Namespace

설명

MdbDataFileEditor 개체는 디자인 타임 및 선택 하 고, Microsoft Access 데이터베이스 파일 (.mdb)에 대 한 URL을 편집 하 고, 다음 컨트롤 속성에 URL을 할당 하는 데 사용 됩니다. 예를 들어 합니다 AccessDataSource 컨트롤이 사용 하는 MdbDataFileEditor 디자인 타임에 값을 설정 하는 클래스를 DataFile 속성입니다.

사용 합니다 EditorAttribute 연결할 특성을 MdbDataFileEditor 속성을 사용 하 여 합니다. 디자이너 호스트를 호출 하는 연결된 된 속성을 디자인 화면에서 편집 하는 경우는 EditValue 메서드. 합니다 EditValue 메서드를 BuildUrl 메서드를 차례로 URL을 선택 하기 위한 사용자 인터페이스를 표시 한 다음 사용자가 선택한 URL을 반환 합니다. GetEditStyle 메서드는 사용자 인터페이스의 표시 스타일을 나타냅니다.

클래스를 파생 합니다 MdbDataFileEditor 는 Access 데이터베이스 URL 속성에 대 한 사용자 지정 편집기를 정의 합니다. 예를 들어 파생된 클래스는 재정의할 수는 EditValue 메서드를 호출 합니다 BuildUrl 메서드를 사용자 지정 Filter 또는 Caption 값.

생성자

MdbDataFileEditor()

MdbDataFileEditor 클래스의 새 인스턴스를 초기화합니다.

속성

Caption

선택 대화 상자에 표시할 캡션을 가져옵니다.

Filter

URL 선택 대화 상자에 나타나는 항목을 필터링하는 데 사용되는 편집기의 URL 필터 옵션을 가져옵니다.

IsDropDownResizable

드롭다운 편집기를 사용자가 크기 조정할 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 UITypeEditor)
Options

사용할 URL 빌더의 옵션을 가져옵니다.

(다음에서 상속됨 UrlEditor)

메서드

EditValue(IServiceProvider, Object)

GetEditStyle() 메서드에 표시된 편집기 스타일을 사용하여 지정된 개체의 값을 편집합니다.

(다음에서 상속됨 UITypeEditor)
EditValue(ITypeDescriptorContext, IServiceProvider, Object)

GetEditStyle(ITypeDescriptorContext)에서 제공하는 편집기 스타일을 사용하여 지정된 개체의 값을 편집합니다.

(다음에서 상속됨 UrlEditor)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetEditStyle()

EditValue(IServiceProvider, Object) 메서드에서 사용하는 편집기 스타일을 가져옵니다.

(다음에서 상속됨 UITypeEditor)
GetEditStyle(ITypeDescriptorContext)

EditValue(ITypeDescriptorContext, IServiceProvider, Object) 메서드의 편집 스타일을 가져옵니다.

(다음에서 상속됨 UrlEditor)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetPaintValueSupported()

이 편집기에서 개체 값 표현를 칠할 수 있는지 여부를 나타냅니다.

(다음에서 상속됨 UITypeEditor)
GetPaintValueSupported(ITypeDescriptorContext)

지정된 컨텍스트에서 지정된 컨텍스트 내의 개체 값 표현를 칠할 수 있는지 여부를 나타냅니다.

(다음에서 상속됨 UITypeEditor)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
PaintValue(Object, Graphics, Rectangle)

지정된 개체의 값 표시를 지정된 캔버스에 칠합니다.

(다음에서 상속됨 UITypeEditor)
PaintValue(PaintValueEventArgs)

지정된 PaintValueEventArgs를 사용하여 개체 값 표현를 칠합니다.

(다음에서 상속됨 UITypeEditor)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보