kewpcg

I have a VSTO Add-in for Word 2007. It contains several windows forms - some small with few controls, some quite large with numerous controls.

I have noticed two problem areas in testing my application, and hoping someone might have some suggestions:

1. When the form is displayed (using ShowDialog), it paints slowly - so you can see it "constructing" itself momentarily. In VB6, I was able to add a DoEvents immediately after calling Show(), which would cause the form to appear more suddenly. I am using SuspendLayout and ResumeLayout in all the right places, I believe. Are there any tricks to make the forms appear in a snappier fashion

2. One of my testers is having trouble with the forms going away when she clicks OK. She clicks OK and the form partially goes away but the majority of the form remains on the screen. She can display other forms (in other words, the 'ghost' fo the form still appears, but it doesn't keep her from performing other actions). The OK button does have the DialogResult of OK and also I have tried using Close() behind the button. This has happened to her both on her laptop and a different PC. I saw it happen for her, but it does not happen for me.

Thanks for any help you can provide.

PS - This behavior is occuring for both my small and large forms, so it doesn't seem to be specific to any one specific form in my app.

kewpcg



Re: Visual Studio Tools for Office Performance/Display issues with Windows Forms

X4U

Hello Kewpcg,

1. For me this looks like in your Form_Load event or in the initialization you do a lot loading data or someting.

A solution for this could be to use a Backgroundthread (Backgroundworker) to load and update the data in background.

So the UI keeps fast and responsible.

Do a search for InvokeRequired will show you some samples how to accomplish this.

2. You need to give the Forms of your AddIN the correct parent WindowHandle -> in .Net a Interface called IWin32Handle

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=489519&SiteID=1

(For Excel but should work for Word too)

Hope this helps,

greets, Helmut






Re: Visual Studio Tools for Office Performance/Display issues with Windows Forms

kewpcg

Thanks for your response.

I don't understand why I would need to give my AddIn a parent WindowHandle - I have not seen this done in any VSTO code samples or solutions... is this something I should be doing in all my VSTO add-in forms

The other part of this that I'm unclear on, is that if all the forms work pretty well for me and only hang for this one user, what is causing the Window handle to fail for this user

Thanks again.

kewpcg





Re: Visual Studio Tools for Office Performance/Display issues with Windows Forms

X4U

Hello kewpcg,

parent handle:

if you don't give your forms a parent window handle -> the default is 0 wich means desktop (as I know) -> good old windows API.

If you don't give them a parent - you can have a form (even a modal one) and sometimes your parent window goes in front of your AddIn (like the Outlook send/receive window - wich is modal true). And so you can never click on your invisible modal form.

So - better is to explicitly say -> the parent of the form is the active window - or application.

So when you have a modal form and you activate the parent-application -> the modal form comes to front.

Only my expirience.

2. You didn't say that the form loading problem happens only on 1 machine and only on 1 form.

I don't know what you are access or the code - so it could be a network-problem or a programming error.

Greets, Helmut






Re: Visual Studio Tools for Office Performance/Display issues with Windows Forms

kewpcg

Thank you for the info.

What I meant to say is that it was happening for one person (a tester), but she has experienced it on a couple of different Word 2007 workstations (one a laptop, one a desktop). She experienced this with several of the forms in my application - not just a single form.

The strange thing about this is that on other PCs, and for other users, the forms all close as expected.





Re: Visual Studio Tools for Office Performance/Display issues with Windows Forms

X4U

Hi,

maybe it's a problem with the graphics driver - not a softwareproblem.

Greets, Helmut.