ControlDesigner 클래스

정의

Control의 디자인 모드 동작을 확장합니다.

public ref class ControlDesigner : System::ComponentModel::Design::ComponentDesigner
public class ControlDesigner : System.ComponentModel.Design.ComponentDesigner
type ControlDesigner = class
    inherit ComponentDesigner
Public Class ControlDesigner
Inherits ComponentDesigner
상속
ControlDesigner
파생

예제

다음 예제 ControlDesigner 구현에서는 처리 MouseEnterMouseLeave 이벤트를 보여 줍니다., 디자이너 코드에서 컨트롤에 그리기 및 디자인 타임에 컨트롤에 대 한 속성을 추가 하는 인터페이스의 IDesignerFilter 일부를 사용 하 여 합니다. 다음 샘플 코드에는 디자이너 및 디자이너와 연결된 샘플 사용자 컨트롤이 포함되어 있습니다. 이 샘플을 빌드하려면 샘플을 클래스 라이브러리로 컴파일하고, 라이브러리에 대한 참조를 Windows Forms 프로젝트에 추가하고, 도구 상자에 컨트롤을 추가하고, 컨트롤의 인스턴스를 양식에 추가합니다. 컨트롤을 가리키면 컨트롤 경계의 내부 윤곽선이 강조 표시되고 윤곽선을 그리는 데 사용되는 색은 디자이너가 컨트롤에 대해 나열된 속성에 추가한 속성에 해당 OutlineColor 합니다.

System.Design 어셈블리에 대한 참조를 추가하여 코드 예제를 컴파일합니다.

using namespace System;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Collections;
using namespace System::Drawing;
using namespace System::Windows::Forms;
using namespace System::Windows::Forms::Design;
using namespace System::Security::Permissions;

   public ref class TestControlDesigner: public System::Windows::Forms::Design::ControlDesigner
   {
   private:
      bool mouseover;
      Color lineColor;

   public:

      property Color OutlineColor 
      {
         Color get()
         {
            return lineColor;
         }

         void set( Color value )
         {
            lineColor = value;
         }

      }
      TestControlDesigner()
      {
         mouseover = false;
         lineColor = Color::White;
      }

   protected:
      virtual void OnMouseEnter() override
      {
         this->mouseover = true;
         this->Control->Refresh();
      }

      virtual void OnMouseLeave() override
      {
         this->mouseover = false;
         this->Control->Refresh();
      }

      virtual void OnPaintAdornments( System::Windows::Forms::PaintEventArgs^ pe ) override
      {
         if ( this->mouseover )
                  pe->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( this->lineColor ),6 ), 0, 0, this->Control->Size.Width, this->Control->Size.Height );
      }

   protected:
      [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)]
      virtual void PreFilterProperties( System::Collections::IDictionary^ properties ) override
      {
         properties->Add( "OutlineColor", TypeDescriptor::CreateProperty( TestControlDesigner::typeid, "OutlineColor", System::Drawing::Color::typeid, nullptr ) );
      }
   };

   [DesignerAttribute(TestControlDesigner::typeid)]
   public ref class TestControl: public System::Windows::Forms::UserControl
   {
   private:
      System::ComponentModel::Container^ components;

   public:
      TestControl()
      {
         components = gcnew System::ComponentModel::Container;
      }

   protected:
      ~TestControl()
      {
         if ( components != nullptr )
         {
            delete components;
         }
      }
   };
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace ControlDesignerExample
{
    // ExampleControlDesigner is an example control designer that 
    // demonstrates basic functions of a ControlDesigner. 
    public class ExampleControlDesigner  : System.Windows.Forms.Design.ControlDesigner
    {
        // This Boolean state reflects whether the mouse is over the control.
        private bool mouseover = false;
        // This color is a private field for the OutlineColor property.
        private Color lineColor = Color.White;

        // This color is used to outline the control when the mouse is 
        // over the control.
        public Color OutlineColor
        {
            get
            {
                return lineColor;
            }
            set
            {
                lineColor = value;
            }
        }

        public ExampleControlDesigner()
        {
        }

        // Sets a value and refreshes the control's display when the 
        // mouse position enters the area of the control.
        protected override void OnMouseEnter()
        {
            this.mouseover = true;
            this.Control.Refresh();
        }    

        // Sets a value and refreshes the control's display when the 
        // mouse position enters the area of the control.        
        protected override void OnMouseLeave()
        {
            this.mouseover = false;            
            this.Control.Refresh();
        }        
        
        // Draws an outline around the control when the mouse is 
        // over the control.    
        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            if (this.mouseover)
            {
                pe.Graphics.DrawRectangle(
                    new Pen(new SolidBrush(this.lineColor), 6), 
                    0, 
                    0, 
                    this.Control.Size.Width, 
                    this.Control.Size.Height);
            }
        }

        // Adds a property to this designer's control at design time 
        // that indicates the outline color to use. 
        // The DesignOnlyAttribute ensures that the OutlineColor
        // property is not serialized by the designer.
        protected override void PreFilterProperties(System.Collections.IDictionary properties)
        {
            PropertyDescriptor pd = TypeDescriptor.CreateProperty(
                typeof(ExampleControlDesigner), 
                "OutlineColor",
                typeof(System.Drawing.Color),
                new Attribute[] { new DesignOnlyAttribute(true) });

            properties.Add("OutlineColor", pd);
        }
    }

    // This example control demonstrates the ExampleControlDesigner.
    [DesignerAttribute(typeof(ExampleControlDesigner))]
    public class ExampleControl : System.Windows.Forms.UserControl
    {        
        private System.ComponentModel.Container components = null;

        public ExampleControl()
        {
            components = new System.ComponentModel.Container();
        }

        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if( components != null )
                components.Dispose();
            }
            base.Dispose( disposing );
        }
    }
}
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Collections
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Windows.Forms.Design

Namespace ControlDesignerExample
    _
    ' ExampleControlDesigner is an example control designer that 
    ' demonstrates basic functions of a ControlDesigner.
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
    Public Class ExampleControlDesigner
        Inherits System.Windows.Forms.Design.ControlDesigner

        ' This boolean state reflects whether the mouse is over the control.
        Private mouseover As Boolean = False
        ' This color is a private field for the OutlineColor property.
        Private lineColor As Color = Color.White

        ' This color is used to outline the control when the mouse is 
        ' over the control.
        Public Property OutlineColor() As Color
            Get
                Return lineColor
            End Get
            Set(ByVal Value As Color)
                lineColor = Value
            End Set
        End Property

        Public Sub New()
        End Sub

        ' Sets a value and refreshes the control's display when the 
        ' mouse position enters the area of the control.
        Protected Overrides Sub OnMouseEnter()
            Me.mouseover = True
            Me.Control.Refresh()
        End Sub

        ' Sets a value and refreshes the control's display when the 
        ' mouse position enters the area of the control.		
        Protected Overrides Sub OnMouseLeave()
            Me.mouseover = False
            Me.Control.Refresh()
        End Sub

        ' Draws an outline around the control when the mouse is 
        ' over the control.	
        Protected Overrides Sub OnPaintAdornments(ByVal pe As System.Windows.Forms.PaintEventArgs)
            If Me.mouseover Then
                pe.Graphics.DrawRectangle(New Pen(New SolidBrush(Me.lineColor), 6), 0, 0, Me.Control.Size.Width, Me.Control.Size.Height)
            End If
        End Sub

        ' Adds a property to this designer's control at design time 
        ' that indicates the outline color to use.
        ' The DesignOnlyAttribute ensures that the OutlineColor
        ' property is not serialized by the designer.
        Protected Overrides Sub PreFilterProperties(ByVal properties As System.Collections.IDictionary)
            Dim pd As PropertyDescriptor = TypeDescriptor.CreateProperty( _
            GetType(ExampleControlDesigner), _
            "OutlineColor", _
            GetType(System.Drawing.Color), _
            New Attribute() {New DesignOnlyAttribute(True)})

            properties.Add("OutlineColor", pd)
        End Sub
    End Class

    ' This example control demonstrates the ExampleControlDesigner.
    <DesignerAttribute(GetType(ExampleControlDesigner))> _
     Public Class ExampleControl
        Inherits System.Windows.Forms.UserControl
        Private components As System.ComponentModel.Container = Nothing

        Public Sub New()
            components = New System.ComponentModel.Container()
        End Sub

        Protected Overloads Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If (components IsNot Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
    End Class

End Namespace

설명

ControlDesigner 에서 파생 Control되는 구성 요소의 디자이너에 대한 기본 클래스를 제공합니다. 클래스 ControlDesigner 에서 ComponentDesigner 상속된 메서드 및 기능 외에도 디자인 타임에 연결된 동작의 확장 및 변경이 지원되는 Control 추가 메서드를 제공합니다.

를 사용하여 DesignerAttribute디자이너를 형식과 연결할 수 있습니다. 디자인 타임 동작을 사용자 지정하는 개요는 Design-Time 지원 확장을 참조하세요.

생성자

ControlDesigner()

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

필드

accessibilityObj

디자이너에 대한 내게 필요한 옵션 지원 개체를 지정합니다.

InvalidPoint

잘못된 Point의 값을 나타내는 로컬 Point를 정의합니다.

속성

AccessibilityObject

컨트롤에 할당된 AccessibleObject를 가져옵니다.

ActionLists

디자이너와 관련된 구성 요소에서 지원하는 디자인 타임 작업 목록을 가져옵니다.

(다음에서 상속됨 ComponentDesigner)
AssociatedComponents

디자이너가 관리하는 구성 요소와 관련된 구성 요소 컬렉션을 가져옵니다.

AutoResizeHandles

AutoSize 속성의 값을 기반으로 크기 조정 핸들이 할당되는지 여부를 나타내는 값을 가져오거나 설정합니다.

BehaviorService

디자인 환경에서 BehaviorService를 가져옵니다.

Component

이 디자이너에서 디자인하고 있는 구성 요소를 가져옵니다.

(다음에서 상속됨 ComponentDesigner)
Control

디자이너가 디자인하고 있는 컨트롤을 가져옵니다.

EnableDragRect

끌기 사각형을 이 디자이너 구성 요소에 그릴 수 있는지 여부를 나타내는 값을 가져옵니다.

InheritanceAttribute

디자이너의 InheritanceAttribute를 가져옵니다.

InheritanceAttribute

관련된 구성 요소의 상속 형식을 나타내는 특성을 가져옵니다.

(다음에서 상속됨 ComponentDesigner)
Inherited

이 구성 요소가 상속되었는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ComponentDesigner)
ParentComponent

ControlDesigner의 부모 구성 요소를 가져옵니다.

ParentComponent

이 디자이너의 부모 구성 요소를 가져옵니다.

(다음에서 상속됨 ComponentDesigner)
ParticipatesWithSnapLines

끌기 작업 동안 ControlDesigner에서 맞춤선 정렬을 허용하는지 여부를 나타내는 값을 가져옵니다.

SelectionRules

구성 요소의 이동 기능을 나타내는 선택 규칙을 가져옵니다.

ShadowProperties

사용자 설정을 재정의하는 속성 값의 컬렉션을 가져옵니다.

(다음에서 상속됨 ComponentDesigner)
SnapLines

이 컨트롤의 중요 맞춤 지점을 나타내는 SnapLine 개체의 목록을 가져옵니다.

Verbs

디자이너와 관련된 구성 요소에서 지원하는 디자인 타임 동사를 가져옵니다.

(다음에서 상속됨 ComponentDesigner)

메서드

BaseWndProc(Message)

Windows 메시지를 처리합니다.

CanBeParentedTo(IDesigner)

이 디자이너의 컨트롤이 지정된 디자이너의 컨트롤을 부모로 사용할 수 있는지 여부를 지정합니다.

DefWndProc(Message)

Windows 메시지에 대한 기본 처리 방법을 제공합니다.

DisplayError(Exception)

지정된 예외에 대한 정보를 사용자에게 표시합니다.

Dispose()

ComponentDesigner에서 사용하는 모든 리소스를 해제합니다.

(다음에서 상속됨 ComponentDesigner)
Dispose(Boolean)

ControlDesigner에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

DoDefaultAction()

구성 요소의 기본 이벤트에 대한 소스 코드 파일에 메서드 시그니처를 만들고 해당 위치로 사용자의 커서를 이동합니다.

(다음에서 상속됨 ComponentDesigner)
EnableDesignMode(Control, String)

자식 컨트롤의 디자인 타임 기능을 사용하도록 설정합니다.

EnableDragDrop(Boolean)

디자인되는 컨트롤에 대한 끌어서 놓기 지원을 활성화 또는 비활성화합니다.

Equals(Object)

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

(다음에서 상속됨 Object)
GetControlGlyph(GlyphSelectionType)

이 컨트롤의 범위를 나타내는 ControlBodyGlyph를 반환합니다.

GetGlyphs(GlyphSelectionType)

표준 컨트롤의 선택 테두리와 잡기 핸들을 나타내는 Glyph 개체의 컬렉션을 가져옵니다.

GetHashCode()

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

(다음에서 상속됨 Object)
GetHitTest(Point)

지정된 지점의 마우스 클릭이 컨트롤에 의해 처리되는지 여부를 지정합니다.

GetService(Type)

디자이너 구성 요소의 디자인 모드 사이트에서 지정된 서비스 종류를 검색합니다.

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

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

(다음에서 상속됨 Object)
HookChildControls(Control)

지정한 컨트롤의 자식 컨트롤에서 메시지를 디자이너로 라우트합니다.

Initialize(IComponent)

디자이너를 지정된 구성 요소로 초기화합니다.

InitializeExistingComponent(IDictionary)

기존 구성 요소를 다시 초기화합니다.

InitializeExistingComponent(IDictionary)

기존 구성 요소를 다시 초기화합니다.

(다음에서 상속됨 ComponentDesigner)
InitializeNewComponent(IDictionary)

새로 만들어진 구성 요소를 초기화합니다.

InitializeNewComponent(IDictionary)

새로 만들어진 구성 요소를 초기화합니다.

(다음에서 상속됨 ComponentDesigner)
InitializeNonDefault()

컨트롤의 속성을 기본값이 아닌 값으로 초기화합니다.

InitializeNonDefault()
사용되지 않습니다.
사용되지 않습니다.

기본값이 아닌 설정으로 이미 초기화되어 가져온 구성 요소의 설정을 초기화합니다.

(다음에서 상속됨 ComponentDesigner)
InternalControlDesigner(Int32)

ControlDesigner에서 지정된 인덱스에 있는 내부 컨트롤 디자이너를 반환합니다.

InvokeGetInheritanceAttribute(ComponentDesigner)

지정된 InheritanceAttributeComponentDesigner를 가져옵니다.

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

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

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

ControlDesigner에 포함된 내부 컨트롤 디자이너의 수를 반환합니다.

OnContextMenu(Int32, Int32)

상황에 맞는 메뉴를 표시하고 이 메뉴가 표시되려고 할 때 추가 작업을 처리할 수 있는 기회를 제공합니다.

OnCreateHandle()

컨트롤 핸들을 만든 직후 추가 작업을 처리할 기회를 제공합니다.

OnDragComplete(DragEventArgs)

끌어서 놓기 작업을 정리하기 위해 호출됩니다.

OnDragDrop(DragEventArgs)

끌어서 놓기 개체를 컨트롤 디자이너 뷰에 놓으면 호출됩니다.

OnDragEnter(DragEventArgs)

끌어서 놓기 작업이 컨트롤 디자이너 뷰에 진입하면 호출됩니다.

OnDragLeave(EventArgs)

끌어서 놓기 작업이 컨트롤 디자이너 뷰를 벗어나면 호출됩니다.

OnDragOver(DragEventArgs)

끌어서 놓기 개체를 컨트롤 디자이너 뷰로 끌어 오면 호출됩니다.

OnGiveFeedback(GiveFeedbackEventArgs)

끌기 작업을 진행하는 동안 마우스 위치에 따라 시각적 정보를 제공하기 위해 끌어서 놓기 작업이 진행되는 동안 호출됩니다.

OnMouseDragBegin(Int32, Int32)

구성 요소를 마우스 왼쪽 단추로 누르고 있는 상태에 대한 응답으로 호출됩니다.

OnMouseDragEnd(Boolean)

끌어서 놓기 작업을 완료하거나 취소하기 위해 해당 작업의 마지막에 호출됩니다.

OnMouseDragMove(Int32, Int32)

끌어서 놓기 작업 중에 마우스를 움직일 때마다 호출됩니다.

OnMouseEnter()

마우스가 컨트롤에 처음으로 진입하면 호출됩니다.

OnMouseHover()

마우스로 컨트롤을 가리키면 호출됩니다.

OnMouseLeave()

마우스가 컨트롤에 처음으로 진입하면 호출됩니다.

OnPaintAdornments(PaintEventArgs)

디자이너에서 관리하는 컨트롤의 위쪽에 추가 장식을 그릴 수 있도록 해당 컨트롤의 표면이 그려지면 호출됩니다.

OnSetComponentDefaults()
사용되지 않습니다.
사용되지 않습니다.

디자이너가 초기화 될 때 호출됩니다.

OnSetCursor()

커서를 설정해야 할 때마다 호출됩니다.

PostFilterAttributes(IDictionary)

디자이너에서 TypeDescriptor를 통해 노출되는 특성 집합의 항목을 변경하거나 제거하도록 합니다.

(다음에서 상속됨 ComponentDesigner)
PostFilterEvents(IDictionary)

디자이너에서 TypeDescriptor를 통해 노출되는 이벤트 집합의 항목을 변경하거나 제거하도록 합니다.

(다음에서 상속됨 ComponentDesigner)
PostFilterProperties(IDictionary)

디자이너에서 TypeDescriptor를 통해 노출되는 속성 집합의 항목을 변경하거나 제거하도록 합니다.

(다음에서 상속됨 ComponentDesigner)
PreFilterAttributes(IDictionary)

디자이너에서 TypeDescriptor를 통해 노출되는 특성 집합에 항목을 추가하도록 합니다.

(다음에서 상속됨 ComponentDesigner)
PreFilterEvents(IDictionary)

디자이너에서 TypeDescriptor를 통해 노출되는 이벤트 집합에 항목을 추가하도록 합니다.

(다음에서 상속됨 ComponentDesigner)
PreFilterProperties(IDictionary)

구성 요소가 TypeDescriptor를 통해 노출하는 속성 집합을 조정합니다.

RaiseComponentChanged(MemberDescriptor, Object, Object)

IComponentChangeService에 이 구성 요소가 변경되었음을 알립니다.

(다음에서 상속됨 ComponentDesigner)
RaiseComponentChanging(MemberDescriptor)

IComponentChangeService에 이 구성 요소가 변경될 예정임을 알립니다.

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

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

(다음에서 상속됨 Object)
UnhookChildControls(Control)

지정한 컨트롤의 자식에 대한 메시지를 부모 디자이너 대신 각 컨트롤에 라우트합니다.

WndProc(Message)

Windows 메시지를 처리하고 필요에 따라 컨트롤로 라우트합니다.

명시적 인터페이스 구현

IDesignerFilter.PostFilterAttributes(IDictionary)

이 멤버에 대한 설명을 보려면 PostFilterAttributes(IDictionary) 메서드를 참조하세요.

(다음에서 상속됨 ComponentDesigner)
IDesignerFilter.PostFilterEvents(IDictionary)

이 멤버에 대한 설명을 보려면 PostFilterEvents(IDictionary) 메서드를 참조하세요.

(다음에서 상속됨 ComponentDesigner)
IDesignerFilter.PostFilterProperties(IDictionary)

이 멤버에 대한 설명을 보려면 PostFilterProperties(IDictionary) 메서드를 참조하세요.

(다음에서 상속됨 ComponentDesigner)
IDesignerFilter.PreFilterAttributes(IDictionary)

이 멤버에 대한 설명을 보려면 PreFilterAttributes(IDictionary) 메서드를 참조하세요.

(다음에서 상속됨 ComponentDesigner)
IDesignerFilter.PreFilterEvents(IDictionary)

이 멤버에 대한 설명을 보려면 PreFilterEvents(IDictionary) 메서드를 참조하세요.

(다음에서 상속됨 ComponentDesigner)
IDesignerFilter.PreFilterProperties(IDictionary)

이 멤버에 대한 설명을 보려면 PreFilterProperties(IDictionary) 메서드를 참조하세요.

(다음에서 상속됨 ComponentDesigner)
ITreeDesigner.Children

이 멤버에 대한 설명을 보려면 Children 속성을 참조하세요.

(다음에서 상속됨 ComponentDesigner)
ITreeDesigner.Parent

이 멤버에 대한 설명을 보려면 Parent 속성을 참조하세요.

(다음에서 상속됨 ComponentDesigner)

적용 대상

추가 정보