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


C# MessageBoxForm类代码示例

本文整理汇总了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();
		}
开发者ID:stewmc,项目名称:vixen,代码行数:31,代码来源:SetupScheduleForm.cs

示例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);
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:34,代码来源:Program.cs

示例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);
     }
 }
开发者ID:Kuzq,项目名称:gitter,代码行数:7,代码来源:CustomMessageBoxService.cs

示例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"});
             }
         }
     }
 }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:25,代码来源:ConfiguratorHostImpl.cs

示例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();
		}
开发者ID:stewmc,项目名称:vixen,代码行数:8,代码来源:OpenDMXInstance.cs

示例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));
 }
开发者ID:panshuiqing,项目名称:winform-ui,代码行数:9,代码来源:MessageBoxEx.cs

示例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!";
			}
		}
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:16,代码来源:GameSettingsUserControl.cs

示例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;
     }
 }
开发者ID:naztrain,项目名称:vixen,代码行数:14,代码来源:SetupDialog.cs

示例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();
     }
 }
开发者ID:naztrain,项目名称:vixen,代码行数:15,代码来源:PreviewCustomCreateForm.cs

示例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();
                }
            }
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:21,代码来源:ColorSetsSetupForm.cs

示例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;
        }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:40,代码来源:MessageBoxExt.cs

示例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);
        }
开发者ID:naztrain,项目名称:vixen,代码行数:40,代码来源:DataProfileForm.cs

示例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;
				}
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:24,代码来源:ParallelPortConfig.cs

示例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;
                        }
                    }
                }
            }
        }
开发者ID:naztrain,项目名称:vixen,代码行数:24,代码来源:TimedSequenceEditorEffectEditor.cs

示例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;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:24,代码来源:PreviewSetElementsUIEditor.cs


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