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.
Unfortunately, activation email could not send to your email. Please try again.

dispose of a control

Thread ID:

Created:

Updated:

Platform:

Replies:

91967 Dec 10,2009 10:07 AM Dec 11,2009 09:51 AM Windows Forms 2
loading
Tags: Tools
Jonathan Richard
Asked On December 10, 2009 10:07 AM

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

Jonathan Richard
Replied On December 10, 2009 11:01 AM

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

Rajasekar B [Syncfusion]
Replied On December 11, 2009 09:51 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;