a_jam_sandwich
Junior Contributor
Hi,
Im currently creating a control inherited from the System.ComponentModel.Design.DesignSurface. So far I have been able to add & remove controls to and from the surface. Using the Selection service to find out selected controls on the surface but what I need to do now is have the ability to drag controls on this service from a very limited list of usercontrols contained within a Toolstrip and place them on the surface.
The controls will need to have some properties set one places on the surface for example there is a field list that once you drag the field onto the surface the field properties are already set within that control based off what as field was initaly dragged.
The only thing I need to do is figure out how to actually initate the drag and drop on a designer surface, searching the .NET had not thown up much in the was of help.
Creation code for the control snippet.
Any pointer would be greatly appreciated
Thanks
Andy
Im currently creating a control inherited from the System.ComponentModel.Design.DesignSurface. So far I have been able to add & remove controls to and from the surface. Using the Selection service to find out selected controls on the surface but what I need to do now is have the ability to drag controls on this service from a very limited list of usercontrols contained within a Toolstrip and place them on the surface.
The controls will need to have some properties set one places on the surface for example there is a field list that once you drag the field onto the surface the field properties are already set within that control based off what as field was initaly dragged.
The only thing I need to do is figure out how to actually initate the drag and drop on a designer surface, searching the .NET had not thown up much in the was of help.
Creation code for the control snippet.
Code:
Public Class Designer
Inherits DesignSurface
Private mobjDragDrop As DesignerDragDrop
Private mobjHost As Control = Nothing
Private mobjSelectionService As ISelectionService = Nothing
Private WithEvents mobjDesignerHost As IDesignerHost = Nothing
Private Function New(ByVal RootType As Type) As IComponent
' Get the designer host/services
Me.mobjDesignerHost = GetServiceDesignerHost()
Me.mobjSelectionService = GetServiceSelectionService()
' Exit if the designer already exists
If (mobjDesignerHost.RootComponent IsNot Nothing) Then Return mobjDesignerHost.RootComponent
' Root componant
Call Me.BeginLoad(RootType)
' Get the designer host
mobjDesignerHost = GetServiceDesignerHost()
' Root control
Dim ctlControl As IComponent = Nothing
ctlControl = mobjDesignerHost.RootComponent
Return ctlControl
End Function
Any pointer would be greatly appreciated
Thanks
Andy