示例#1
0
        public SetActionDialog(MainForm owner, MedicalViewer viewer, MedicalViewerCell selectedCell, MedicalViewerActionType actionType)
        {
            InitializeComponent();
            _viewer       = viewer;
            _actionType   = actionType;
            _SelectedCell = selectedCell;
            this.Text     = "Set " + GetSeparatedText(actionType.ToString()) + " Action";

            if (selectedCell.IsValidForAction(actionType, MedicalViewerMouseButtons.Wheel))
            {
                _cmbMouseButton.Items.Insert(4, "Wheel");
            }

            if (selectedCell.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyTo.Items.Add("Selected Cells");
                _cmbApplyTo.Items.Add("All Cells");
            }

            if (selectedCell.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyingMethod.Items.Add("On Release");
            }

            MedicalViewerActionFlags actionFlags = selectedCell.GetActionFlags(actionType);

            if ((actionFlags | MedicalViewerActionFlags.OnRelease) == actionFlags)
            {
                _cmbApplyingMethod.SelectedIndex = 1;
            }
            else
            {
                _cmbApplyingMethod.SelectedIndex = 0;
            }

            if ((actionFlags | MedicalViewerActionFlags.Selected) == actionFlags)
            {
                _cmbApplyTo.SelectedIndex = 1;
            }
            else if ((actionFlags | MedicalViewerActionFlags.AllCells) == actionFlags)
            {
                _cmbApplyTo.SelectedIndex = 2;
            }
            else
            {
                _cmbApplyTo.SelectedIndex = 0;
            }

            _cmbMouseButton.SelectedIndex = (int)selectedCell.GetActionButton(actionType);
        }