System.Windows.Forms.ToolTip.Dispose C# (CSharp) Method

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
		protected override void Dispose(bool disposing) {
			// call the base impl first to avoid conflicts with any parent's events
			base.Dispose (disposing);

			if (disposing) {
				// Mop up the mess; or should we wait for the GC to kick in?
				timer.Stop();
				timer.Dispose();

				// Not sure if we should clean up tooltip_window
				tooltip_window.Dispose();

				tooltip_strings.Clear();
				
				//UIA Framework: ToolTip isn't associated anymore
				foreach (Control control in controls)
					OnUIAToolTipUnhookUp (this, new ControlEventArgs (control));
				controls.Clear();
			}
		}

Usage Example

        /// <summary>Initializes a new instance of the <see cref="SplitContainerTools"/> class.</summary>
        /// <param name="container">
        /// The <see cref="System.Windows.Forms.SplitContainer"/> to which this instance will be bound.
        /// </param>
        public SplitContainerTools(SplitContainer container)
        {
            split = container;
            _keepFocus = false;
            _showGripper = true;
            _showButtons = SplitContainerButtons.None;
            _panel1Border = false;
            _panel2Border = false;
            _buttons = new SplitContainerButton[] { };
            _tooltip = new ToolTip();

            _splitRectInternal = typeof(SplitContainer).GetField("splitterRect", Reflection.BindingFlags.NonPublic |
                                                                                 Reflection.BindingFlags.GetField |
                                                                                 Reflection.BindingFlags.Instance);

            split.Paint += split_Paint;
            split.MouseDown += split_MouseDown;
            split.MouseUp += split_MouseUp;
            split.MouseClick += split_MouseClick;
            split.MouseMove += split_MouseMove;
            split.MouseLeave += (o, e) => split.Cursor = Cursors.Default;
            split.SplitterMoved += split_SplitterMoved;
            split.SizeChanged += split_Resize;
            split.Disposed += (o, e) => _tooltip.Dispose();

            ((Panel)split.Panel1).ClientSizeChanged += Split_Panel_CollapsedChanged;
            ((Panel)split.Panel2).LocationChanged += Split_Panel_CollapsedChanged;
        }
All Usage Examples Of System.Windows.Forms.ToolTip::Dispose