471,337 Members | 835 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Drag and drop broken in Designer Host?

I've inherited a body of C# code that has a 'Designer Host' (DH) based UI.
Custom controls are selected from a 'toolbox' window and placed/sized
in the DH interface. I'm trying to add a feature that allows the user to
drag data, specifically a string, from another window to one of these
controls,
without success. Part of the control definition is:

[Designer(typeof(TactControlDesigner))]
public class TactControl : UserControl
{
...
protected void tactDragOver(object sender,
System.Windows.Forms.DragEventArgs e) {
Console.WriteLine("drag over tact");
e.Effect = DragDropEffects.Link;
}

protected void tactDragDrop(object sender,
System.Windows.Forms.DragEventArgs e) {
string dropArg = (string) e.Data.GetData(typeof (System.String));
if (dropArg != null) {
MessageBox.Show(dropArg);
}
}

public TactControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitializeComponent call
this.AllowDrop = true;
this.DragOver += new System.Windows.Forms.DragEventHandler(tactDragOver );
this.DragDrop += new System.Windows.Forms.DragEventHandler(tactDragDrop );

}
. . . neither of the drag event handlers ever get called.

I had thought that this DH technology (about which I'm extremely ignorant)
might not be creating windows for these controls, but Spy++ shows otherwise.

The definition of the DH class being used starts off:

[ProvideProperty("Name", typeof(IComponent))]
internal class DesignerHost : IDesignerHost, IContainer,
IComponentChangeService, IExtenderProvider, ITypeDescriptorFilterService,
IExtenderListService, IExtenderProviderService
{

I'm guessing that the DH stuff might mess with the drag-drop procedure
in order to implement its own toolbox interactions, but I've no idea how,
and no idea where to look.

Any thoughts or pointers would be appreciated . . .
Jan 4 '06 #1
0 1129

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Clyde | last post: by
6 posts views Thread by jojobar | last post: by
2 posts views Thread by Philippe Meunier | last post: by
4 posts views Thread by kemal asad | last post: by
5 posts views Thread by Brian Henry | last post: by
2 posts views Thread by Robert Zahm | last post: by
4 posts views Thread by stef | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.