프레임 워크 4.0을 대상으로하는 VS2010에서 빈 두 번째 행이있는 TableLayoutPanel을 포함하는 UserControl이 있습니다.Windows Form Designer에서 UserControl 하위 클래스를 편집 하시겠습니까?
Windows Forms 디자이너를 사용하여이 두 번째 행에 항목을 추가 할 수 있습니까? 아니면 코드를 통해 모든 작업을 수행해야합니까?
EDIT : Hans Passant의 의견에 대한 회신에서 연결된 질문은 다른 컨트롤에서 사용되는 UserControl을 참조합니다. 상속 된 컨트롤에 대해 질문하고 있습니다.
Public Class TestInheritedControl
Inherits TestControl
End Class
가 생성 : 새 파일에 다음 클래스를 생성
Imports System.ComponentModel
Imports System.Windows.Forms.Design
<Designer(GetType(testDesigner))>
Public Class TestControl
End Class
Public Class testDesigner
Inherits ControlDesigner
Public Overrides Sub Initialize(component As System.ComponentModel.IComponent)
MyBase.Initialize(component)
Dim X As TestControl = CType(component, TestControl)
EnableDesignMode(X.TableLayoutPanel1, "TableLayoutPanelX")
End Sub
End Class
:
난을 testControl는 "TableLayoutPanel1"라는 TableLayoutPanel을 포함하는 UserControl을하다 다음 테스트 코드를 만들었습니다 디자이너에서 볼 때 디자이너가 편집 할 수없는 "TableLayoutPanel1"이라는 TableLayoutPanel이 포함 된 컨트롤입니다. 이것은 원래의 질문에 설명 된 상황이며 해결되지 않았습니다.
이전 UserControls에서 상속하지 않고 새 UserControl을 만든 다음 TestControl을 배치하면 "TestControl1.TableLayoutPanelX"라는 Designer 편집 가능 TableLayoutPanel이있는 TestControl 인스턴스가 만들어집니다.
위의 그림에서 TestInheritedControl
클래스를 Designer로 편집 할 수있는 방법이 있습니까?
[사용자 정의 UserControl에서 컨트롤 기능을 버블하는 방법] (http://stackoverflow.com/questions/2785376/how-to-bubble-a-controls-features-when-place) -in-a-custom-usercontrol) –
같은 일입니다. [Designer]는 기본 클래스가 아닌 상속 된 클래스에 적용되어야합니다. –