void DisposeLabelGroup() { m_ToolStripItem.Checked = false; m_LabelGroup.Clear(); m_LabelGroup.Dispose(); m_LabelGroup = null; }
protected override void OnClosing(CancelEventArgs e) { // Remove the listener from our context menu items. m_ItemCreate.Click -= new EventHandler(m_ItemCreate_Click); m_ItemDestroy.Click -= new EventHandler(m_ItemDestroy_Click); // Remove the menu item "Example 7" from the 3D Context Menu. SDKViewer.UI.ContextMenu3D.Items.Remove(m_Item); m_Labels.Clear(); // clear the dictionary, no need for it anymore. // Remove all the labels from the 3D engine by clearing labelgroups and Delete the label group from the 3D engine. m_LabelGroup.Clear(); m_LabelGroup.Dispose(); m_LabelGroup = null; // Remove the reference to the menu items objects. m_Item = null; m_ItemCreate = null; m_ItemDestroy = null; base.OnClosing(e); }