में टूल टिप के ऊपर साफ स्वचालित करने के लिए मैं एक स्मृति रिसाव पर नज़र रखने के लिए किया गया है और मैं एक टूलटिप कि एक UserControl व्युत्पन्न वर्ग में आवंटित किया जाता है करने के लिए इसे नीचे संकुचित है।कैसे UserControl
ToolTip इस तरह नियंत्रण के निर्माता में आवंटित में आवंटित और लोड घटना में आरंभ नहीं हो जाता:
public class CommonProfile : System.Windows.Forms.UserControl
{
private ToolTip toolTip1;
...
public CommonProfile()
{
InitializeComponent();
// Create the ToolTip and associate with the Form container.
toolTip1 = new ToolTip(this.components);
}
private void CommonProfile_Load(object sender, System.EventArgs e)
{
// Set up the delays for the ToolTip.
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip1.ShowAlways = true;
// Set up the ToolTip text
toolTip1.SetToolTip(this.btnDeleteEntry, "Delete this Profile");
toolTip1.SetToolTip(this.lblProfileType, "Edit this Profile");
toolTip1.SetToolTip(this.lblProfileData, "Edit this Profile");
toolTip1.SetToolTip(this.picFlagForUpdate, "Toggle Flag for Update");
}
}
नियंत्रण के माता-पिता एक जीवन भर है कि नियंत्रण के जीवनकाल से अधिक है। यह नियंत्रण मक्खी पर बनाया गया है और एक पैनल नियंत्रण को जोड़ा गया और फिर आगे चलकर पैनल नियंत्रण से हटा दिया है।
मैंने पाया कि नियंत्रण के निपटान सदस्य नहीं बुलाया हो रही किया गया था, जाहिरा तौर पर क्योंकि ToolTip के लिए संदर्भ रहते हैं।
public void Shutdown()
{
toolTip1.RemoveAll();
}
शटडाउन विधि कॉलिंग रिसाव निकल जाते हैं और निपटान के अंत में कहा जाता है:
मैं इस तरह एक शटडाउन विधि गयी।
दुर्भाग्य से, इस समाधान जो कोई भी नियंत्रण का उपयोग करता है, जब वे यह के साथ समाप्त कर शटडाउन विधि कॉल करने के याद करता है कि आवश्यकता है।
मैं अगर वहाँ किसी तरह है कि मैं इस स्वचालित कर सकते हैं इतना है कि यह बंद विधि स्पष्ट रूप से कॉल करने के लिए की आवश्यकता के बिना होता है जानना चाहते हैं।
मैं तुम्हें टूलटिप पर निपटाने या तो अपने usercontrol के निपटाने में कॉल करने की आवश्यकता है लगता है या आप एक साफ अप समारोह जो आपके लिए है कि करता है, अपने बंद विधि की तरह हो सकता था। यहाँ – PRR
1. देखो [http://stackoverflow.com/questions/672980/dispose-on-user-controls-really-meant-to-edit-the-designer-cs-file][1] [1]: http://stackoverflow.com/questions/672980/dispose-on-user-controls-really-meant-to-edit-the-designer-cs-file – VMykyt