Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Problem Location when Ctrl-Drag is done on Design Surface.
 

Problem Location when Ctrl-Drag is done on Design Surface.

I have problem with Ctrl-Drag of control on the design surface.When i do Ctrl-drag the original control is moved down to the dragged location and the newly copied control is in the Old control location.

Please help me in solving this. My inplementaion is same as (http://msdn.microsoft.com/msdnmag/issues/06/03/DesignerHosting/default.aspx implementation.

Thanks in Advance.

Sankeetha.

sankee  Monday, November 12, 2007 6:51 AM

You should add a ComponentSerializationService service to the DesignSurface. In the HostSurface class in that sample you posted, add the following two lines of code in it would work fine.


Code Block

class HostSurface : DesignSurface

BasicDesignerLoader _loader;

private ISelectionService _selectionService;

public HostSurface() : base()

{

this.AddService(typeof(IMenuCommandService), new MenuCommandService(this));

this.AddService(typeof(ComponentSerializationService),

new CodeDomComponentSerializationService(this));

}

HostSurface(IServiceProvider parentProvider) : base(parentProvider)

{

this.AddService(typeof(IMenuCommandService), new MenuCommandService(this));

this.AddService(typeof(ComponentSerializationService),

new CodeDomComponentSerializationService(this));

}

……�/span>

Zhi-Xin Ye  Friday, November 16, 2007 8:13 AM

You should add a ComponentSerializationService service to the DesignSurface. In the HostSurface class in that sample you posted, add the following two lines of code in it would work fine.


Code Block

class HostSurface : DesignSurface

BasicDesignerLoader _loader;

private ISelectionService _selectionService;

public HostSurface() : base()

{

this.AddService(typeof(IMenuCommandService), new MenuCommandService(this));

this.AddService(typeof(ComponentSerializationService),

new CodeDomComponentSerializationService(this));

}

HostSurface(IServiceProvider parentProvider) : base(parentProvider)

{

this.AddService(typeof(IMenuCommandService), new MenuCommandService(this));

this.AddService(typeof(ComponentSerializationService),

new CodeDomComponentSerializationService(this));

}

……�/span>

Zhi-Xin Ye  Friday, November 16, 2007 8:13 AM

Thanks for your reply.

But this service is already added.But my problem is, i.e.,if i have a Label1 and i change the Color of Label1 to Green when i Ctrl-Drag i should get a green Label1 in the dragged Location.

But after making a copy of the Original control, the cloned control is in the original control location and the Original control

is in the Dragged Location(The location between the Dragged and original one's are interchanged).

Thanks

sankee  Monday, November 19, 2007 11:44 AM

You can use google to search for other answers

Custom Search

More Threads

• how to create simple IDE? - from Where to start ?
• Custom Shaped Windows Forms
• Preventing control re-parenting on a design surface
• grouped checkboxes
• Need to build a listbox containing a checkbox and image
• Extender provider and type converter
• Treenode Editor Question
• Output Data from a DataGrid
• Chat component
• How to get Domain Role collection