本文整理汇总了C#中MessageBoxForm类的典型用法代码示例。如果您正苦于以下问题:C# MessageBoxForm类的具体用法?C# MessageBoxForm怎么用?C# MessageBoxForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageBoxForm类属于命名空间,在下文中一共展示了MessageBoxForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buttonOK_Click
private void buttonOK_Click(object sender, EventArgs e)
{
if (dateStart.Value > dateStop.Value)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The end date of a show must fall after the start date.", "Date Error", false, true);
messageBox.ShowDialog();
return;
}
_scheduleItem.StartDate = dateStart.Value;
_scheduleItem.EndDate = dateStop.Value;
_scheduleItem.Sunday = checkSunday.Checked;
_scheduleItem.Monday = checkMonday.Checked;
_scheduleItem.Tuesday = checkTuesday.Checked;
_scheduleItem.Wednesday = checkWednesday.Checked;
_scheduleItem.Thursday = checkThursday.Checked;
_scheduleItem.Friday = checkFriday.Checked;
_scheduleItem.Saturday = checkSaturday.Checked;
_scheduleItem.StartTime = dateStartTime.Value;
_scheduleItem.EndTime = dateEndTime.Value;
_scheduleItem.Enabled = checkEnabled.Checked;
if (comboBoxShow.SelectedIndex >= 0)
{
Shows.Show show = ((comboBoxShow.SelectedItem as Common.Controls.ComboBoxItem).Value) as Shows.Show;
_scheduleItem.ShowID = show.ID;
}
DialogResult = System.Windows.Forms.DialogResult.OK;
Close();
}
示例2: Main
private static void Main()
{
try
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.ThreadException += Application_ThreadException;
bool result;
var mutex = new Mutex(true, "Vixen3RunningInstance", out result);
if (!result)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("Another instance is already running; please close that one before trying to start another.",
"Vixen 3 already active", false, false);
messageBox.ShowDialog();
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new VixenApplication());
// mutex shouldn't be released - important line
GC.KeepAlive(mutex);
}
catch (Exception ex)
{
Logging.Fatal(ErrorMsg, ex);
Environment.Exit(1);
}
}
示例3: Show
public DialogResult Show(IWin32Window parent, string message, string caption, MessageBoxButton button, MessageBoxIcon icon)
{
using(var msgbox = new MessageBoxForm(button, icon, message, caption))
{
return msgbox.ShowDialog(parent);
}
}
示例4: Run
public void Run()
{
using (StubLogging logging = new StubLogging())
//using (ModuleLoader loader = new ModuleLoader(logging))
{
try
{
ConfiguratorConfiguration config = new ConfiguratorConfiguration(logging);
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU", false);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
using (_mainForm = new MainForm(config))
Application.Run(_mainForm);
}
catch (Exception ex)
{
logging.WriteError(ex.ToString());
using (MessageBoxForm dlg = new MessageBoxForm())
{
dlg.ShowForm(null, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error,
new[] {"OK"});
}
}
}
}
示例5: Setup
public override bool Setup()
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Information; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("Nothing to Setup", "", false, false);
messageBox.ShowDialog();
return base.Setup();
}
示例6: Show
public static DialogResult Show(
IWin32Window owner, string text, string caption, MessageBoxButtons buttons,
Bitmap icon, MessageBoxDefaultButton defaultButton, MessageBoxIcon beepType)
{
NativeMethods.MessageBeep((int)beepType);
MessageBoxForm form = new MessageBoxForm();
return form.ShowMessageBoxDialog(new MessageBoxArgs(
owner, text, caption, buttons, icon, defaultButton));
}
示例7: ScanButton_Click
/// <summary>
/// Scan for games
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ScanButton_Click(object sender, EventArgs e)
{
MessageBoxForm form = new MessageBoxForm();
form.StartPosition = FormStartPosition.CenterParent;
var result = form.ShowForm("Scan for games on your computer?", "Scan", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
var success = System.Threading.ThreadPool.QueueUserWorkItem(ScanGames);
if (!success) ScanProgressLabel.Text = "Scan failed!";
}
}
示例8: buttonOK_Click
private void buttonOK_Click(object sender, EventArgs e)
{
if (_PortAddress == 0)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The port address is 0.", "595 Setup", false, false);
messageBox.ShowDialog();
messageBox.DialogResult = DialogResult.None;
}
else {
_data.Port = _PortAddress;
}
}
示例9: buttonOK_Click
private void buttonOK_Click(object sender, EventArgs e)
{
if (TemplateName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) {
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The template name must be a valid file name. Please ensure there are no invalid characters in the template name.",
"Invalid Template Name", false, true);
messageBox.ShowDialog();
DialogResult = messageBox.DialogResult;
}
else {
DialogResult = DialogResult.OK;
Close();
}
}
示例10: buttonAddColorSet_Click
private void buttonAddColorSet_Click(object sender, EventArgs e)
{
using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) {
if (textDialog.ShowDialog() == DialogResult.OK) {
string newName = textDialog.Response;
if (_data.ContainsColorSet(newName)) {
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("Color Set already exists.", "Error", false, false);
messageBox.ShowDialog();
return;
}
ColorSet newcs = new ColorSet();
_data.SetColorSet(newName, newcs);
UpdateGroupBoxWithColorSet(newName, newcs);
UpdateColorSetsList();
}
}
}
示例11: Show
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, string[] buttonText, bool useCancelButton)
{
//int n = Application.OpenForms.Count - 1;
//Form owner = null;
//if (n > -1)
// owner = Application.OpenForms[n];
//if (owner != null)
// owner.BringToFront();
IntPtr zero = IntPtr.Zero;
if (owner == null)
{
zero = Process.GetCurrentProcess().MainWindowHandle;
//zero = NativeMethod.GetActiveWindow();
owner = Form.FromHandle(zero);
}
else
{
zero = owner.Handle;
}
DialogResult result;
using (MessageBoxForm frm = new MessageBoxForm())
{
if (!useCancelButton)
{
frm.ControlBox = false;
frm.CancelButton = new Button(); // Иначе по Esc закрывается форма.
}
result = frm.ShowForm(owner, text, caption, buttons, icon, buttonText, useCancelButton);
}
//if (zero != IntPtr.Zero)
//{
// NativeMethod.SendMessage(zero, 7, 0, 0);
//}
return result;
}
示例12: buttonAddProfile_Click
private void buttonAddProfile_Click(object sender, EventArgs e)
{
SaveCurrentItem();
TextDialog dialog = new TextDialog("Enter a name for the new profile","Profile Name","New Profile");
while (dialog.ShowDialog() == DialogResult.OK)
{
if (dialog.Response == string.Empty)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("Profile name can not be blank.",
"Error", false, false);
messageBox.ShowDialog();
}
if (comboBoxProfiles.Items.Cast<ProfileItem>().Any(items => items.Name == dialog.Response))
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("A profile with the name " + dialog.Response + @" already exists.", "", false, false);
messageBox.ShowDialog();
}
if (dialog.Response != string.Empty && comboBoxProfiles.Items.Cast<ProfileItem>().All(items => items.Name != dialog.Response))
{
break;
}
}
if (dialog.DialogResult == DialogResult.Cancel)
return;
ProfileItem item = new ProfileItem { Name = dialog.Response, DataFolder = _defaultFolder + " " + dialog.Response };
comboBoxProfiles.Items.Add(item);
comboBoxProfiles.SelectedIndex = comboBoxProfiles.Items.Count - 1;
PopulateLoadProfileSection(false);
}
示例13: OkButton_Click
private void OkButton_Click(object sender, EventArgs e)
{
if (portComboBox.SelectedIndex == _OtherAddressIndex) {
if (PortAddress != 0) {
try {
Convert.ToUInt16(portTextBox.Text, 0x10);
}
catch {
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The port number is not a valid hexadecimal number.", "Parallel Port Setup", false, false);
messageBox.ShowDialog();
base.DialogResult = DialogResult.None;
}
}
else {
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The port address is 0.", "Parallel Port Setup", false, false);
messageBox.ShowDialog();
DialogResult = DialogResult.None;
}
}
}
示例14: TimedSequenceEditorEffectEditor
public TimedSequenceEditorEffectEditor(IEnumerable<EffectNode> effectNodes)
: this(effectNodes.First())
{
if (effectNodes != null && effectNodes.Count() > 1) {
_effectNodes = effectNodes;
Text = "Edit Multiple Effects";
// show a warning if multiple effect types are selected
EffectNode displayedEffect = effectNodes.First();
if (displayedEffect != null) {
foreach (EffectNode node in effectNodes) {
if (node.Effect.TypeId != displayedEffect.Effect.TypeId)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The selected effects contain multiple types. Once you finish editing, these values will " +
"only be applied to the effects of type '" + displayedEffect.Effect.Descriptor.TypeName + "'.", "Warning", false, false);
messageBox.ShowDialog();
break;
}
}
}
}
}
示例15: EditValue
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
IWindowsFormsEditorService svc = (IWindowsFormsEditorService)
provider.GetService(typeof (IWindowsFormsEditorService));
if (svc != null) {
List<PreviewBaseShape> shapes = value as List<PreviewBaseShape>;
if (shapes.Count < 1)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("Elements must have at least one shape. Remove the selected element.", "Error", false, false);
messageBox.ShowDialog();
if (value != null) return value;
}
PreviewSetElements elementsDialog = new PreviewSetElements(shapes);
svc.ShowDialog(elementsDialog);
// update etc
if (shapes[0].Parent != null)
{
shapes[0].Parent.Layout();
}
}
return value;
}