protected override void OnTermination() { if (String.Equals(hideBtn.Text, "-DrawOpts-")) { ChartControl.ChartObjects.InsertComplete -= objects_added; } ChartControl.Controls.Remove(drawPanel); drawPanel.Dispose(); if (strip != null) { strip.Items.Remove(hideBtn); hideBtn.Dispose(); } base.OnTermination(); }
private bool disposedValue = false; // To detect redundant calls /// <summary> /// When overridden in a derived class, releases the unmanaged resources used by /// the <see cref="ApplicationWindowControl"/>, and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (Process != null) { Process.Kill(); Process.Dispose(); Panel.Dispose(); } } disposedValue = true; } }