ScrollableControl
을 확장하여 사용자 정의 컨트롤을 작성하고 있습니다.
문제는 컨테이너로 그 내 사용자 지정 컨트롤 행위이다 - 나는 그것으로 컨트롤을 드래그 할 수 있습니다 : 이 UserControl extends ScrollableControl - 컨테이너 기능을 비활성화하십시오.
내 질문은 내가 ScrollableControl
아래는 두 개의 테스트 컨트롤, 하나 확장 클래스에서 컨테이너 기능을 해제 할 수있는 방법입니다 둘째, Control
확장 ScrollableControl
이 이러한 목표를 달성하기 위해 하나 이상의 방법은 아마,하지만 여기에 내가 무엇을 할 것이라고입니다
public class ControlBasedControl : Control
{
protected override Size DefaultSize
{
get { return new Size(100, 100); }
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.FillRectangle(Brushes.LightCoral, ClientRectangle);
}
}
public class ScrollableControlBasedControl : ScrollableControl
{
public ScrollableControlBasedControl()
{
AutoScrollMinSize = new Size(200, 200);
}
protected override Size DefaultSize
{
get { return new Size(100, 100); }
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.FillRectangle(Brushes.LawnGreen, ClientRectangle);
}
}
아마도 Drop 이벤트를 컨테이너 속성이 null이거나 대상 컨트롤에서 자식을 삭제하려고 할 수 있습니다. –
@BaranovskiyDmitry 디자인 타임으로 비활성화하려고합니다. 놓기 이벤트는 런타임에 작동합니다. – Misiu