Strange behaviour using Drag and Drop in word 2003 automation in headers
Posted
by Oliver Hanappi
on Stack Overflow
See other posts from Stack Overflow
or by Oliver Hanappi
Published on 2010-03-18T07:13:44Z
Indexed on
2010/03/19
7:01 UTC
Read the original article
Hit count: 398
Hi!
I am developing a template based addin for Word 2003 which allows the user to drag and drop elements from a listbox into the word document. Unfortunately I'm getting a really strange behaviour when trying to drop elements in the document's header.
- Open the template and type something in the header
- Close the header and insert some content on the page
- Add a page break.
- Switch to page layout mode where and set zoom level to "Two Pages"
- Open the header
- Slowly Drag and Drop an list item from the list box to the header.
- See multiple Page Setups dialogs occur which cause Word to crash.
Here is my code:
// in ThisDocument.cs
public MyUserControl _control;
public void Init()
{
_control = new MyUserControl();
ActionsPane.Controls.Add(_control);
ActionsPane.Visible = true;
}
// in MyUserControl.cs
public void listBox1_MouseDown(object sender, MouseEventArgs e)
{
DoDragDrop("something", DragDropEffects.Copy);
}
Have I done somethinkg wrong with implementing Drag and Drop? Is there a workaround for this strange behaviour?
Thanks in advance,
Oliver Hanappi
© Stack Overflow or respective owner