当前位置: 首页>>代码示例>>C#>>正文


C# MessageBoxButtons类代码示例

本文整理汇总了C#中MessageBoxButtons的典型用法代码示例。如果您正苦于以下问题:C# MessageBoxButtons类的具体用法?C# MessageBoxButtons怎么用?C# MessageBoxButtons使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MessageBoxButtons类属于命名空间,在下文中一共展示了MessageBoxButtons类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyButtons

 void ApplyButtons(MessageBoxButtons buttons)
 {
     HideAllButtons();
     if (buttons == MessageBoxButtons.OK)
     {
         PositiveButton.Visibility = System.Windows.Visibility.Visible;
         PositiveButton.Content = AppStrings.OKButtonText;
     }
     else if (buttons == MessageBoxButtons.OKCancel)
     {
         PositiveButton.Visibility = System.Windows.Visibility.Visible;
         NegativeButton.Visibility = System.Windows.Visibility.Visible;
         PositiveButton.Content = AppStrings.OKButtonText;
         NegativeButton.Content = AppStrings.CancelButtonText;
     }
     else if (buttons == MessageBoxButtons.YesNo)
     {
         PositiveButton.Visibility = System.Windows.Visibility.Visible;
         NegativeButton.Visibility = System.Windows.Visibility.Visible;
         PositiveButton.Content = AppStrings.YesButtonText;
         NegativeButton.Content = AppStrings.NoButtonText;
     }
     else if (buttons == MessageBoxButtons.Custom)
     {
         PositiveButton.Visibility = string.IsNullOrEmpty(_model.PositiveButtonText) ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
         NegativeButton.Visibility = string.IsNullOrEmpty(_model.NegativeButtonText) ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
         CancelButton.Visibility = string.IsNullOrEmpty(_model.CancelButtonText) ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
         PositiveButton.Content = _model.PositiveButtonText;
         NegativeButton.Content = _model.NegativeButtonText;
         CancelButton.Content = _model.CancelButtonText;
     }
 }
开发者ID:ktei,项目名称:MySpace,代码行数:32,代码来源:MessageBoxView.xaml.cs

示例2: Show

 /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show6"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Displays a message box with specified text, caption, and style.
 ///       Makes the dialog RTL if the resources for this dll have been localized to a RTL language.
 ///    </para>
 /// </devdoc>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, 
                                 MessageBoxDefaultButton defaultButton, MessageBoxOptions options) {
     if (RTLAwareMessageBox.IsRTLResources) {
         options |= (MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
     }
     return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:RTLAwareMessageBox.cs

示例3: MiserugeErrorException

 public MiserugeErrorException(string message, string dialogTitle, MessageBoxIcon icon, MessageBoxButtons buttons)
     : base(message)
 {
     this.DialogTitle = dialogTitle;
     this.Icon = icon;
     this.Buttons = buttons;
 }
开发者ID:ouaiea,项目名称:miseruge1,代码行数:7,代码来源:MiserugeErrorException.cs

示例4: CustomMessageBox

 public CustomMessageBox(string Title, string Msg, MessageBoxButtons Buttons)
 {
     InitializeComponent();
     MsgButtons = Buttons;
     Message = Msg;
     TitleText = Title;
 }
开发者ID:ShanioDeJesus,项目名称:FBLA,代码行数:7,代码来源:CustomMessageBox.cs

示例5: Show

        /// <summary>
        /// Draws a MessageBox that always stays on top with a title, selectable buttons and an icon
        /// </summary>
        static public DialogResult Show(string message, string title,
            MessageBoxButtons buttons,MessageBoxIcon icon)
        {
            // Create a host form that is a TopMost window which will be the 

            // parent of the MessageBox.

            Form topmostForm = new Form();
            // We do not want anyone to see this window so position it off the 

            // visible screen and make it as small as possible

            topmostForm.Size = new System.Drawing.Size(1, 1);
            topmostForm.StartPosition = FormStartPosition.Manual;
            System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
            topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10,
                rect.Right + 10);
            topmostForm.Show();
            // Make this form the active form and make it TopMost

            topmostForm.Focus();
            topmostForm.BringToFront();
            topmostForm.TopMost = true;
            // Finally show the MessageBox with the form just created as its owner

            DialogResult result = MessageBox.Show(topmostForm, message, title,
                buttons,icon);
            topmostForm.Dispose(); // clean it up all the way


            return result;
        }
开发者ID:matalangilbert,项目名称:stromohab-2008,代码行数:35,代码来源:TopMostMessageBox.cs

示例6: Show

        /// <summary>
        /// Shows the alert dialog.
        /// </summary>
        /// <param name="core">
        /// The StyleCop core instance.
        /// </param>
        /// <param name="parent">
        /// The parent control.
        /// </param>
        /// <param name="message">
        /// The message to display on the dialog.
        /// </param>
        /// <param name="title">
        /// The title of the dialog.
        /// </param>
        /// <param name="buttons">
        /// The dialog buttons.
        /// </param>
        /// <param name="icon">
        /// The dialog icon.
        /// </param>
        /// <returns>
        /// Returns the dialog result.
        /// </returns>
        public static DialogResult Show(StyleCopCore core, Control parent, string message, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            Param.RequireNotNull(core, "core");
            Param.Ignore(parent);
            Param.RequireValidString(message, "message");
            Param.RequireValidString(title, "title");
            Param.Ignore(buttons);
            Param.Ignore(icon);

            if (core.DisplayUI)
            {
                return DisplayMessageBox(parent, message, title, buttons, icon);
            }
            else
            {
                // Alert Dialogs which provide options other than OK cannot be handled when the 
                // program is running in a non-UI mode.
                if (buttons != MessageBoxButtons.OK)
                {
                    throw new InvalidOperationException(Strings.AlertDialogWithOptionsInNonUIState);
                }

                SendToOutput(core, message, icon);
                return DialogResult.OK;
            }
        }
开发者ID:kopelli,项目名称:Visual-StyleCop,代码行数:50,代码来源:AlertDialog.cs

示例7: Info

 public static DialogResult Info(String message, MessageBoxButtons buttons)
 {
     Logger.Info(message);
     return MessageBox.Show(message
         , Session.GetResStr("information")
         , buttons, MessageBoxIcon.Information);
 }
开发者ID:AndrianDTR,项目名称:Atlantic,代码行数:7,代码来源:UIMessages.cs

示例8: ShowMessage

 public static void ShowMessage(string message, string title = "HLSL Tools",
     MessageBoxButtons messageBoxButtons = MessageBoxButtons.OK,
     MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning,
     MessageBoxDefaultButton messageBoxDefaultButton = MessageBoxDefaultButton.Button1)
 {
     MessageBox.Show(message, title, messageBoxButtons, messageBoxIcon, messageBoxDefaultButton);
 }
开发者ID:pminiszewski,项目名称:HlslTools,代码行数:7,代码来源:Logger.cs

示例9: Show

        public static DialogResult Show(string Caption,MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            Msgbox = new extramessage_frm();
            Msgbox.txt.Text = Caption;

            if (icon == MessageBoxIcon.Information)
            {
                Msgbox.pictureBox1.BackgroundImage = Almas.Properties.Resources.info;
                Msgbox.Text = "پیام";
            }
            else if (icon == MessageBoxIcon.Error)
            {
                Msgbox.pictureBox1.BackgroundImage = Almas.Properties.Resources.error;
                Msgbox.Text = "اخطار";
            }
            else if (icon == MessageBoxIcon.Warning)
            {
                Msgbox.pictureBox1.BackgroundImage = Almas.Properties.Resources.warning;
                Msgbox.Text = "هشدار";
            }

            if (buttons == MessageBoxButtons.OK)
            {
                Msgbox.panel1.Visible = true;
                Msgbox.panel2.Visible = false;
            }
            else if (buttons == MessageBoxButtons.YesNo)
            {
                Msgbox.panel2.Visible = true;
                Msgbox.panel1.Visible = false;
            }
            Msgbox.ShowDialog();
            return result;
        }
开发者ID:mr-amini,项目名称:Almas,代码行数:34,代码来源:extramessage_frm.cs

示例10: Show

        public static DialogResult Show(string RichTextMessage, string StaticMessage, string WindowTitle, MessageBoxButtons Buttons)
        {
            RichTextMessageBox messageBox = new RichTextMessageBox();
            messageBox.rtbMessage.Text = RichTextMessage;
            messageBox.lblStaticMessage.Text = StaticMessage;
            messageBox.Text = WindowTitle;
            messageBox.buttons = Buttons;

            switch (Buttons)
            {
                case MessageBoxButtons.OK:
                    messageBox.button1.Visible = false;
                    messageBox.button2.Visible = false;
                    messageBox.button3.Text = "OK";
                    messageBox.button3.Tag = DialogResult.OK;
                    break;
                case MessageBoxButtons.OKCancel:
                    messageBox.button1.Visible = false;
                    messageBox.button2.Text = "OK";
                    messageBox.button2.Tag = DialogResult.OK;
                    messageBox.button3.Text = "Cancel";
                    messageBox.button3.Tag = DialogResult.Cancel;
                    break;
                default:
                    throw new NotImplementedException("Buttons option '" + Convert.ToString(Buttons) + "' is not supported.");
            }

            return messageBox.ShowDialog();
        }
开发者ID:bgripka,项目名称:AppConfig,代码行数:29,代码来源:RichTextMessageBox.cs

示例11: QuickBooksException

 public QuickBooksException(string displayMessage, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     _displayMessage = displayMessage;
     _caption = caption;
     _buttons = buttons;
     _icon = icon;
 }
开发者ID:ryanpagel,项目名称:OrderEntry,代码行数:7,代码来源:Exceptions.cs

示例12: MessageForm

        public MessageForm(MessageFormType type, string message, string caption, ExceptionInfo exceptionInfo, MessageBoxButtons buttons, string[] attachedFilePathes, MessageFormSettings settingsOverrides)
        {
            var defaultSettings = DefaultMessageFormSettingsProvider.GetDefaultMessageFormSettings();
            _settings = MessageFormSettings.Merge(settingsOverrides, defaultSettings);
            _messageData = CreateMessageFormData(type, message, caption, exceptionInfo, _settings);
            _buttons = buttons;
            _attachedFilePathes = attachedFilePathes;

            InitializeComponent();

            this.Text = _messageData.Title;
            this.SetMessage(_messageData.DisplayText);
            this.SetIcon(type);

            switch (_messageData.MessageType)
            {
                case MessageFormType.Error:
                case MessageFormType.Warning:
                    this.ShowErrorDetails();
                    break;
            }

            this.InitializeButtons(type, buttons);
            this.ResizeView(_messageData.DisplayText);
        }
开发者ID:rapidsoft-development,项目名称:rapidsoft-etl,代码行数:25,代码来源:MessageForm.cs

示例13: Show

 /// <summary>
 /// 一般的なダイアログ表示用メソッドです。
 /// </summary>
 public static DialogResult Show(IWin32Window owner, string message,
                                 string title,
                                 MessageBoxButtons buttons)
 {
     return WinForms.MessageBox.Show(
         owner, message, title, buttons);
 }
开发者ID:leontius,项目名称:Ragnarok,代码行数:10,代码来源:DialogUtil.cs

示例14: MessageBoxForm

        /// <summary>
        /// Create a messagebox with the specific buttons. This is a temporary addition until this can be rewritten.
        /// </summary>
        /// <param name="messageBoxData"></param>
        /// <param name="messageBoxTitle"></param>
        /// <param name="buttons"></param>
        /// <param name="icon"></param>
        public MessageBoxForm(string messageBoxData, string messageBoxTitle, MessageBoxButtons buttons, Icon icon)
        {
            if (icon != null)
            {
                msgIcon = icon;
            }
            InitializeComponent();
            InitMessageBox(messageBoxData, messageBoxTitle);

            if (buttons == MessageBoxButtons.OKCancel)
            {
                buttonOk.Location = buttonNo.Location;
                buttonCancel.Visible = true;
            }
            else if(buttons == MessageBoxButtons.YesNo)
            {
                buttonCancel.Visible = false;
                buttonOk.Text = @"YES";
                buttonNo.Visible = true;
            }
            else if (buttons == MessageBoxButtons.YesNoCancel)
            {
                buttonCancel.Visible = true;
                buttonOk.Visible = true;
                buttonNo.Visible = true;
                buttonOk.Text = @"YES";
            }
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:35,代码来源:MessageBoxForm.cs

示例15: Show

 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
 {
     _owner = owner;
     Initialize();
     return MessageBox.Show(owner, text, caption, buttons, icon,
                            defButton, options);
 }
开发者ID:gitsly,项目名称:CodingSandbox,代码行数:7,代码来源:MessageBoxCentered.cs


注:本文中的MessageBoxButtons类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。