GUI Not Refreshing with AX Control

M

Microsoft

I am having a problem where the gui is not refreshing. I have an ActiveX
control that displays output from a ccd camera on the main gui. The control
is embedded in a usercontrol. The usercontrol has a public method that will
allow a reference it itself to be passed back so that other classes can
invoke methods and change properties on the AX control. This is important,
since other classes may be responsible for doing things like adjusting
shutter speed in response to changes in lighting levels, etc.

SO...the main symptom is that if I create a button on the same user control
as the AX control (main thread), then everything works fine (images are
displayed). If I do the exact same thing by calling a public method on the
AX's usercontrol from some other class (still on main thread), the gui does
not update at all. I have used beginInvoke(), Invoke() using delegates, and
neither seems to work. I verified that these calls were occuring on the
main thread using thread debug window. Help?
 
J

Jeffrey Tan[MSFT]

Hi,

I think that because your AX control do the IO operation with ccd camera in
the main thread.
IO operation is a long time work, it will block the paint message's
process, so your UI will hang.
I think you need create a worker thread for retrieving data from camera,
and use ManualResetEvent to communicate with main thread.
Also, you can use Control.Invalidate method to refresh the control.

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top