ControlDesigner 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
의 디자인 모드 동작을 확장합니다 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 구현에서는 처리 MouseEnter 및 MouseLeave 이벤트를 보여 줍니다., 디자이너 코드에서 컨트롤에 그리기 및 디자인 타임에 컨트롤에 대 한 속성을 추가 하는 인터페이스의 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.
생성자
| Name | Description |
|---|---|
| ControlDesigner() |
ControlDesigner 클래스의 새 인스턴스를 초기화합니다. |
필드
| Name | Description |
|---|---|
| accessibilityObj |
디자이너의 접근성 개체를 지정합니다. |
| InvalidPoint |
속성
| Name | Description |
|---|---|
| AccessibilityObject |
컨트롤에 AccessibleObject 할당된 값을 가져옵니다. |
| ActionLists |
디자이너와 연결된 구성 요소에서 지원하는 디자인 타임 작업 목록을 가져옵니다. (다음에서 상속됨 ComponentDesigner) |
| AssociatedComponents |
디자이너에서 관리하는 구성 요소와 연결된 구성 요소의 컬렉션을 가져옵니다. |
| AutoResizeHandles |
크기 조정 핸들 할당이 속성 값에 따라 달라지는지 여부를 나타내는 값을 AutoSize 가져오거나 설정합니다. |
| BehaviorService |
BehaviorService 디자인 환경에서 가져옵니다. |
| Component |
이 디자이너가 디자인하는 구성 요소를 가져옵니다. (다음에서 상속됨 ComponentDesigner) |
| Control |
디자이너가 디자인하는 컨트롤을 가져옵니다. |
| EnableDragRect |
이 디자이너 구성 요소에서 끌기 사각형을 그릴 수 있는지 여부를 나타내는 값을 가져옵니다. |
| InheritanceAttribute |
디자이너의 InheritanceAttribute 값을 가져옵니다. |
| InheritanceAttribute |
연결된 구성 요소의 상속 유형을 나타내는 특성을 가져옵니다. (다음에서 상속됨 ComponentDesigner) |
| Inherited |
이 구성 요소가 상속되는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 ComponentDesigner) |
| ParentComponent |
에 대한 ControlDesigner부모 구성 요소를 가져옵니다. |
| ParticipatesWithSnapLines |
끌기 작업 중에 맞춤선 맞춤을 ControlDesigner 허용할지 여부를 나타내는 값을 가져옵니다. |
| SelectionRules |
구성 요소의 이동 기능을 나타내는 선택 규칙을 가져옵니다. |
| SetTextualDefaultProperty |
의 디자인 모드 동작을 확장합니다 Control. (다음에서 상속됨 ComponentDesigner) |
| ShadowProperties |
사용자 설정을 재정의하는 속성 값의 컬렉션을 가져옵니다. (다음에서 상속됨 ComponentDesigner) |
| SnapLines |
이 컨트롤의 SnapLine 중요한 맞춤 지점을 나타내는 개체 목록을 가져옵니다. |
| Verbs |
디자이너와 연결된 구성 요소에서 지원하는 디자인 타임 동사를 가져옵니다. (다음에서 상속됨 ComponentDesigner) |
메서드
| Name | Description |
|---|---|
| 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) |
기존 구성 요소를 다시 초기화합니다. |
| InitializeNewComponent(IDictionary) |
새로 만든 구성 요소를 초기화합니다. |
| InitializeNonDefault() |
컨트롤의 속성을 기본값이 아닌 값으로 초기화합니다. |
| InitializeNonDefault() |
사용되지 않음.
사용되지 않음.
기본값이 아닌 설정으로 이미 초기화된 가져온 구성 요소에 대한 설정을 초기화합니다. (다음에서 상속됨 ComponentDesigner) |
| InternalControlDesigner(Int32) |
에 지정된 인덱스가 있는 내부 컨트롤 디자이너를 반환합니다 ControlDesigner. |
| InvokeGetInheritanceAttribute(ComponentDesigner) |
지정된 . InheritanceAttribute 의 값을 가져옵니다 ComponentDesigner. (다음에서 상속됨 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 메시지를 처리하고 필요에 따라 컨트롤로 라우팅합니다. |
명시적 인터페이스 구현
| Name | Description |
|---|---|
| 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) |