protected override void OnCheckedChanged(EventArgs e)
        {
            base.OnCheckedChanged(e);

            // If this item is no longer in the checked state or if its
            // parent has not yet been initialized, do nothing.
            if (!Checked || this.Parent == null)
            {
                return;
            }

            // Clear the checked state for all siblings.
            foreach (ToolStripItem item in Parent.Items)
            {
                ToolStripRadioButtonMenuItem radioItem =
                    item as ToolStripRadioButtonMenuItem;
                if (radioItem != null && radioItem != this && radioItem.Checked)
                {
                    radioItem.Checked = false;

                    // Only one item can be selected at a time,
                    // so there is no need to continue.
                    return;
                }
            }
        }
Esempio n. 2
0
        public void CreateDebugMenu(ToolStripMenuItem parent)
        {
            var item1 = new ToolStripRadioButtonMenuItem("MouseKeyboard");

            item1.Click += (sender, e) => { InputDevice = UserInputDevices.MouseKeyboard; };
            var item2 = new ToolStripRadioButtonMenuItem("GamePad");

            item2.Click += (sender, e) => { InputDevice = UserInputDevices.Pad; };
            parent.DropDownItems.AddRange(new ToolStripItem[] { item1, item2 });

            item2.Checked = true;
        }
Esempio n. 3
0
        public void CreateDebugMenu(ToolStripMenuItem parent)
        {
            var menuItem = new ToolStripMenuItem("Camera");

            parent.DropDownItems.Add(menuItem);

            var item1 = new ToolStripRadioButtonMenuItem("free camera");

            item1.Click += (sender, e) => { ActivateCamera(FreeCameraName); };
            var item2 = new ToolStripRadioButtonMenuItem("fixed camera");

            item2.Click += (sender, e) => { ActivateCamera(FixedCameraName); };
            var item3 = new ToolStripRadioButtonMenuItem("follow entity camera");

            item3.Click += (sender, e) => { ActivateCamera(FollowEntityCameraName); };
            menuItem.DropDownItems.AddRange(new ToolStripItem[] { item1, item2, item3 });

            item3.Checked = true;
        }