Example #1
0
        private void viewZoomMenu_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            ToolStripRadioButtonMenuItem selectedMenu = sender as ToolStripRadioButtonMenuItem;

            selectedMenu.Checked = true;

            if (selectedMenu.Equals(viewZoom25Menu))
            {
                this.imageViewer.ZoomFactor = 0.25f;
            }
            else if (selectedMenu.Equals(viewZoom50Menu))
            {
                this.imageViewer.ZoomFactor = 0.5f;
            }
            else if (selectedMenu.Equals(viewZoom75Menu))
            {
                this.imageViewer.ZoomFactor = 0.75f;
            }
            else
            {
                this.imageViewer.ZoomFactor = 1.0f;
            }

            Cursor.Current = Cursors.Default;
        }
        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;
                }
            }
        }