We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

dispose of a control

Hi,

When I close a window I would like to dispose its embedded control. I use this code:

mDockingManager.SetEnableDocking(myCtrl, false);
myCtrl.Dispose();

When I call the method SetEnableDocking I see a annoying ficker of my control that appears during an instant before being disposed.

In older post I saw that you recommend to use the method LockHostFormUpdate() to avoid flicker but this as no effect when the window is floating.

Do you have other suggestions to avoid flickers? I also tried the LockDockPanelsUpdate but it come with others problems (application behing my application is draw over mine). thanks

2 Replies

JR Jonathan Richard December 10, 2009 04:01 PM UTC

I found a custom trick to avoid the flicker for now. I set the size of my control to 0 before calling the SetEnableDocking(myCtrl,false). It seems to be working...does someone have a better idea? Thank you

Jonathan


RB Rajasekar B Syncfusion Team December 11, 2009 02:51 PM UTC

Hi Jonathan,

Flicker occurs when you disable the docking for any control because once the setEnableDocking(ctrl, false) is called the docking window is removed from the control. But the control still remains in the same position till you dispose it.

You can also set the region of the control to 0 before calling SetEnableDocking. Below is the sample code:

this.ctrl.Region=new Region(new Rectangle(0,0,0,0));
this.dockingManager1.SetEnableDocking(this.ctrl, false);
this.ctrl.Dispose();

Let me kow if you have any question.

Thanks,
Rajasekar

Loader.
Live Chat Icon For mobile
Up arrow icon