示例#1
0
        private static void ButtonClick(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            switch (btn.Text)
            {
            case "Abort":
                _buttonResult = DialogResult.Abort;
                break;

            case "Retry":
                _buttonResult = DialogResult.Retry;
                break;

            case "Ignore":
                _buttonResult = DialogResult.Ignore;
                break;

            case "OK":
                _buttonResult = DialogResult.OK;
                break;

            case "Cancel":
                _buttonResult = DialogResult.Cancel;
                break;

            case "Yes":
                _buttonResult = DialogResult.Yes;
                break;

            case "No":
                _buttonResult = DialogResult.No;
                break;
            }

            _msgBox.Dispose();
        }