Exemplo n.º 1
0
        /// <summary>
        /// Initalizes the component with a specified parent and name.
        /// </summary>
        /// <param name="physicsGroupsTabControl"></param>
        /// <param name="name"></param>
        public ComponentPropertiesTabPage(PropertySetsTabControl physicsGroupsTabControl, string name)
        {
            InitializeComponent();

            parentControl = physicsGroupsTabControl;

            SetName(name);

            ChildForm = new ComponentPropertiesForm(this);
            Controls.Add(ChildForm);

            rightClickMenu = new ContextMenu();
            rightClickMenu.MenuItems.Add(new MenuItem("Delete", new EventHandler(deleteMenuItem_onClick)));
            rightClickMenu.MenuItems.Add(new MenuItem("Change Name", new EventHandler(changeNameMenuItem_onClick)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if interaction events are enabled before switching tabs.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PropertySetsTabControl_Deselecting(object sender, TabControlCancelEventArgs e)
        {
            if (e.TabPage != null)
            {
                Control[] controlCollection = SelectedTab.Controls.Find("ComponentPropertiesForm", false);

                if (controlCollection.Length > 0)
                {
                    ComponentPropertiesForm form = (ComponentPropertiesForm)controlCollection[0];
                    if (form != null)
                    {
                        if (form.InteractionEnabled)
                        {
                            e.Cancel = true;
                            MessageBox.Show("Please exit select mode before changing or adding tabs.", "Invalid operation.");
                        }
                    }
                }
            }
        }