本文整理汇总了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;
}
}
示例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);
}
示例3: MiserugeErrorException
public MiserugeErrorException(string message, string dialogTitle, MessageBoxIcon icon, MessageBoxButtons buttons)
: base(message)
{
this.DialogTitle = dialogTitle;
this.Icon = icon;
this.Buttons = buttons;
}
示例4: CustomMessageBox
public CustomMessageBox(string Title, string Msg, MessageBoxButtons Buttons)
{
InitializeComponent();
MsgButtons = Buttons;
Message = Msg;
TitleText = Title;
}
示例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;
}
示例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;
}
}
示例7: Info
public static DialogResult Info(String message, MessageBoxButtons buttons)
{
Logger.Info(message);
return MessageBox.Show(message
, Session.GetResStr("information")
, buttons, MessageBoxIcon.Information);
}
示例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);
}
示例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;
}
示例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();
}
示例11: QuickBooksException
public QuickBooksException(string displayMessage, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
_displayMessage = displayMessage;
_caption = caption;
_buttons = buttons;
_icon = icon;
}
示例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);
}
示例13: Show
/// <summary>
/// 一般的なダイアログ表示用メソッドです。
/// </summary>
public static DialogResult Show(IWin32Window owner, string message,
string title,
MessageBoxButtons buttons)
{
return WinForms.MessageBox.Show(
owner, message, title, buttons);
}
示例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";
}
}
示例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);
}