• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MessageBoxIcon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Show

        // **********************************
        // Output an error or warning message
        // **********************************
        public static DialogResult Show(string messageTitle, string messageText, MessageBoxIcon messageBoxIcon, MessageBoxButtons messageButtons, bool neverShowTouchOptimized = false)
        {
            // If we are running in SebWindowsClient we need to activate it before showing the password dialog
            if (SEBClientInfo.SebWindowsClientForm != null) SebWindowsClientMain.SEBToForeground();

            DialogResult messageBoxResult;
            if (!neverShowTouchOptimized && (Boolean) SEBClientInfo.getSebSetting(SEBSettings.KeyTouchOptimized)[SEBSettings.KeyTouchOptimized] == true)
            {
                messageBoxResult =
                    MetroMessageBox.Show(
                        new Form()
                        {
                            TopMost = true,
                            Top = 0,
                            Left = 0,
                            Width = Screen.PrimaryScreen.Bounds.Width,
                            Height = Screen.PrimaryScreen.Bounds.Height
                        }, messageText, messageTitle, messageButtons, messageBoxIcon);
            }
            else
            {
                messageBoxResult = MessageBox.Show(new Form() { TopMost = true }, messageText, messageTitle, messageButtons, messageBoxIcon);
            }

            return messageBoxResult;
        }
开发者ID:SafeExamBrowser,项目名称:seb-win,代码行数:29,代码来源:SEBMessageBox.cs


示例2: Show

		public static DialogResult Show(string msg, string title, MessageBoxButtons btns, MessageBoxIcon icon)
		{
			// Create a callback delegate
			_hookProcDelegate = new Win32.WindowsHookProc(HookCallback);

			// Remember the title & message that we'll look for.
			// The hook sees *all* windows, so we need to make sure we operate on the right one.
			_msg = msg;
			_title = title;

			// Set the hook.
			// Suppress "GetCurrentThreadId() is deprecated" warning. 
			// It's documented that Thread.ManagedThreadId doesn't work with SetWindowsHookEx()
#pragma warning disable 0618
			_hHook = Win32.SetWindowsHookEx(Win32.WH_CBT, _hookProcDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId());
#pragma warning restore 0618

			// Pop a standard MessageBox. The hook will center it.
			DialogResult rslt = MessageBox.Show(msg, title, btns, icon);

			// Release hook, clean up (may have already occurred)
			Unhook();

			return rslt;
		}
开发者ID:sketchout,项目名称:ChatClient,代码行数:25,代码来源:MsgBox.cs


示例3: GetShowReference

        /// <summary>
        /// 获取显示确认对话框的客户端脚本
        /// </summary>
        /// <param name="message">对话框消息</param>
        /// <param name="title">对话框标题</param>
        /// <param name="icon">对话框图标</param>
        /// <param name="okScriptstring">点击确定按钮执行的客户端脚本</param>
        /// <param name="cancelScript">点击取消按钮执行的客户端脚本</param>
        /// <param name="target">弹出对话框的目标页面</param>
        /// <returns>客户端脚本</returns>
        public static string GetShowReference(string message, string title, MessageBoxIcon icon, string okScriptstring, string cancelScript, Target target)
        {
            //string msgBoxScript = "var msgBox=Ext.MessageBox;";
            //msgBoxScript += "if(parent!=window){msgBox=parent.window.Ext.MessageBox;}";
            if (String.IsNullOrEmpty(title))
            {
                title = "X.util.confirmTitle";
            }
            else
            {
                title = JsHelper.GetJsString(title.Replace("\r\n", "\n").Replace("\n", "<br/>"));
            }
            message = message.Replace("\r\n", "\n").Replace("\n", "<br/>");

            JsObjectBuilder ob = new JsObjectBuilder();
            ob.AddProperty("title", title, true);
            ob.AddProperty("msg", JsHelper.GetJsStringWithScriptTag(message), true);
            ob.AddProperty("buttons", "Ext.MessageBox.OKCANCEL", true);
            ob.AddProperty("icon", String.Format("{0}", MessageBoxIconHelper.GetName(icon)), true);
            ob.AddProperty("fn", String.Format("function(btn){{if(btn=='cancel'){{{0}}}else{{{1}}}}}", cancelScript, okScriptstring), true);

            string targetName = "window";
            if (target != Target.Self)
            {
                targetName = TargetHelper.GetScriptName(target);
            }
            return String.Format("{0}.Ext.MessageBox.show({1});", targetName, ob.ToString());
        }
开发者ID:jinwmmail,项目名称:RDFNew,代码行数:38,代码来源:Confirm.cs


示例4: showMessage

		public DialogResult showMessage(IWin32Window owner, string message, string title, MessageBoxIcon icon, MessageBoxButtons buttons) {

			//Wenn kein Owner mitgegeben wurde, dann Versuchen das Hauptfenster anzuzeigen
			if (owner == null || owner.Handle == IntPtr.Zero)
				owner = new dummyWindow(Process.GetCurrentProcess().MainWindowHandle);

			const string appTitle = "updateSystem.NET Administration";

			//Nachricht loggen
			logLevel lLevel;
			switch (icon) {
				case MessageBoxIcon.Error:
					lLevel = logLevel.Error;
					break;
				case MessageBoxIcon.Exclamation:
					lLevel = logLevel.Warning;
					break;
				default:
					lLevel = logLevel.Info;
					break;
			}
			Log.writeState(lLevel,
			                        string.Format("{0}{1}", string.IsNullOrEmpty(title) ? "" : string.Format("{0} -> ", title),
			                                      message));

			var dlgResponse = Environment.OSVersion.Version.Major >= 6
			       	? showTaskDialog(owner, appTitle, title, message, buttons, icon)
			       	: showMessageBox(owner, appTitle, title, message, icon, buttons);

			Log.writeKeyValue(lLevel, "Messagedialogresult", dlgResponse.ToString());

			return dlgResponse;
		}
开发者ID:hbaes,项目名称:updateSystem.NET,代码行数:33,代码来源:applicationSession.Messages.cs


示例5: GetName

        public static string GetName(MessageBoxIcon type)
        {
            string result = String.Empty;

            switch (type)
            {
                case MessageBoxIcon.Information:
                    //result = "ext-mb-info";
                    result = "Ext.MessageBox.INFO";
                    break;
                case MessageBoxIcon.Warning:
                    //result = "ext-mb-warning";
                    result = "Ext.MessageBox.WARNING";
                    break;
                case MessageBoxIcon.Question:
                    //result = "ext-mb-question";
                    result = "Ext.MessageBox.QUESTION";
                    break;
                case MessageBoxIcon.Error:
                    //result = "ext-mb-error";
                    result = "Ext.MessageBox.ERROR";
                    break;
            }

            return result;
        }
开发者ID:g992com,项目名称:esb,代码行数:26,代码来源:MessageBoxIcon.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: ShowMessageBox

        public static int? ShowMessageBox(string title, string text, IEnumerable<string> buttons, int focusButton, MessageBoxIcon icon)
        {
            // don't do anything if the guide is visible - one issue this handles is showing dialogs in quick
            // succession, we have to wait for the guide to go away before the next dialog can display
            if (Guide.IsVisible) return null;

            // if we have a result then we're all done and we want to return it
            if (dialogResult != null)
            {
                // preserve the result
                int? saveResult = dialogResult;

                // reset everything for the next message box
                dialogResult = null;
                Showing = false;

                // return the result
                return saveResult;
            }

            // return nothing if the message box is still being displayed
            if (Showing) return null;

            // otherwise show it
            Showing = true;
            Guide.BeginShowMessageBox(title, text, buttons, focusButton, icon, MessageBoxEnd, null);
            return null;
        }
开发者ID:kevinpfab,项目名称:Pew-Pew-Pod,代码行数:28,代码来源:SimpleMessageBox.cs


示例8: frmExceptionHandler

 private frmExceptionHandler(Exception exceptionToPublish, bool restartAllowed, MessageBoxIcon iconType)
     : this()
 {
     this.ExceptionToPublish = exceptionToPublish;
     this.AllowContinueButton = restartAllowed;
     this.m_mode = iconType;
     if (iconType == MessageBoxIcon.Asterisk)
         this.pbIcon.Image = System.Drawing.SystemIcons.Asterisk.ToBitmap();
     else if (iconType == MessageBoxIcon.Error)
         this.pbIcon.Image = System.Drawing.SystemIcons.Error.ToBitmap();
     else if (iconType == MessageBoxIcon.Exclamation)
         this.pbIcon.Image = System.Drawing.SystemIcons.Exclamation.ToBitmap();
     else if (iconType == MessageBoxIcon.Hand)
         this.pbIcon.Image = System.Drawing.SystemIcons.Hand.ToBitmap();
     else if (iconType == MessageBoxIcon.Information)
         this.pbIcon.Image = System.Drawing.SystemIcons.Information.ToBitmap();
     else if (iconType == MessageBoxIcon.None)
         this.pbIcon.Image = null;
     else if (iconType == MessageBoxIcon.Question)
         this.pbIcon.Image = System.Drawing.SystemIcons.Question.ToBitmap();
     else if (iconType == MessageBoxIcon.Stop)
         this.pbIcon.Image = System.Drawing.SystemIcons.Shield.ToBitmap();
     else if (iconType == MessageBoxIcon.Warning)
         this.pbIcon.Image = System.Drawing.SystemIcons.Warning.ToBitmap();
 }
开发者ID:afrael,项目名称:OAGlobalExceptionHandler,代码行数:25,代码来源:frmExceptionHandler.cs


示例9: KFreonMessageBox

        /// <summary>
        /// Provides a more customisable MessageBox with 3 buttons available. 
        /// DialogResults: Button1 = OK, button2 = Abort, button3 = Cancel.
        /// </summary>
        /// <param name="Title"></param>
        /// <param name="Message"></param>
        /// <param name="Button1Text"></param>
        /// <param name="Button2Text"></param>
        /// <param name="Button3Text"></param>
        /// <param name="icon"></param>
        public KFreonMessageBox(string Title, string Message, string Button1Text, MessageBoxIcon icon, string Button2Text = null, string Button3Text = null)
        {
            InitializeComponent();
            this.Text = Title;
            label1.Text = Message;
            button1.Text = Button1Text;

            if (Button2Text != null)
                button2.Text = Button2Text;
            button2.Visible = Button2Text != null;

            if (Button3Text != null)
                button3.Text = Button3Text;
            button3.Visible = Button3Text != null;

            // KFreon: Reset positions?
            //166, 500 = 330


            // KFreon: Deal with icon/picture
            if (pictureBox1.Image != null)
                pictureBox1.Image.Dispose();

            if (icon != 0)
                pictureBox1.Image = GetSystemImageForMessageBox(icon);
            else
                pictureBox1.Image = new Bitmap(1, 1);
        }
开发者ID:CreeperLava,项目名称:ME3Explorer,代码行数:38,代码来源:KFreonMessageBox.cs


示例10: ShowMessage

        public override void ShowMessage(string text, string caption, MessageBoxIcon icon)
        {
            var @class = String.Empty;

            switch (icon)
            {
                case MessageBoxIcon.Error:
                    @class = "alert alert-danger";
                    break;
                case MessageBoxIcon.Information:
                    @class = "alert alert-success";
                    break;
                case MessageBoxIcon.None:
                    @class = "alert alert-info";
                    break;
                case MessageBoxIcon.Question:
                    @class = "alert alert-warning";
                    break;
                case MessageBoxIcon.Warning:
                    @class = "alert alert-warning";
                    break;
            }

            message_container.InnerHtml += RenderMessage(caption, text, @class);

            message_container.Visible = true;
        }
开发者ID:jorik041,项目名称:X.DynamicData,代码行数:27,代码来源:Site.master.cs


示例11: DisplayException

		/// <summary>
		/// Displays a message box containing information about an exception, for the currently executing application, plus optional additional information.
		/// </summary>
		/// <param name="owner">The window owning the dialog</param>
		/// <param name="caption">The caption to display on the dialog</param>
		/// <param name="icon">The icon to display on the dialog</param>
		/// <param name="buttons">The buttons to display on the dialog</param>
		/// <param name="ex">The exception to display on the dialog</param>
		/// <param name="infoLines">Optional additional information to display on the dialog</param>
		/// <returns>The result of the dialog</returns>
		public static DialogResult DisplayException(IWin32Window owner, string caption, MessageBoxIcon icon, MessageBoxButtons buttons, Exception ex, params string[] infoLines)
		{
			bool hasAdditionalInfo = false;
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			
			/// begin with the application information that generated the exception
			sb.Append(string.Format("The application '{0}' has encountered the following exception or condition.\n\n", Path.GetFileName(System.Windows.Forms.Application.ExecutablePath)));
			
			/// append the additional information if any was supplied
			if (infoLines != null)
			{
				hasAdditionalInfo = true;
				sb.Append("Additional Information:\n\n");
				foreach(string line in infoLines)
					sb.Append(string.Format("{0}\n", line));
			}
						
			if (ex != null)
			{
				/// append the information contained in the exception
				sb.Append(string.Format("{0}Exception Information:\n\n", (hasAdditionalInfo ? "\n" : null)));
				sb.Append(ex.ToString());
			}

			/// display a message and return the result
			return MessageBox.Show(owner, sb.ToString(), caption, buttons, icon);
		}
开发者ID:FireBall1725,项目名称:Carbon.Framework,代码行数:37,代码来源:ExceptionUtilities.cs


示例12: Show

        /// <summary>
        /// Displays a message box.
        /// </summary>
        /// <param name="owner">Owner window.</param>
        /// <param name="text">Text to display.</param>
        /// <param name="caption">Text to display in the title bar.</param>
        /// <param name="cdText">Text to display near check box.</param>
        /// <param name="buttons">Buttons to display in the message box.</param>
        /// <param name="icon">Icon to display in the mesage box.</param>
        /// <returns>One of the <see cref="DialogResult"/> values.</returns>
        public DialogResult Show(IWin32Window owner, string text, string caption, string cdText, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            button1.Click += new EventHandler(OnButtonClick);
            button2.Click += new EventHandler(OnButtonClick);
            button3.Click += new EventHandler(OnButtonClick);

            this.Text = caption;
            msgText.Text = text;
            cbOption.Text = cdText;

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                NativeMethods.EnableMenuItem(NativeMethods.GetSystemMenu(this.Handle, false), 
                    NativeMethods.SC_CLOSE, NativeMethods.MF_BYCOMMAND | NativeMethods.MF_GRAYED);
            }
            else this.ControlBox = false;

            SetButtonsToDisplay(buttons);

            SetIconToDisplay(icon);
            
            MessageBeep(icon);

            ShowDialog(owner);

            return m_dialogResult;
        }
开发者ID:wow4all,项目名称:evemu_server,代码行数:37,代码来源:MsgBoxCustom.cs


示例13: Mes

 public static DialogResult Mes(string descr, MessageBoxIcon icon = MessageBoxIcon.Information, MessageBoxButtons butt = MessageBoxButtons.OK)
 {
     if (descr.Length > 0)
         return MessageBox.Show(descr, Application.ProductName, butt, icon);
     else
         return DialogResult.OK;
 }
开发者ID:pipiscrew,项目名称:TrueCryptSimpleGUI,代码行数:7,代码来源:General.cs


示例14: KryptonMessageBox

        private KryptonMessageBox(string text, string caption,
                                  MessageBoxButtons buttons, MessageBoxIcon icon,
                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
                                  HelpInfo helpInfo)
        {
            // Store incoming values
            _text = text;
            _caption = caption;
            _buttons = buttons;
            _icon = icon;
            _defaultButton = defaultButton;
            _options = options;
            _helpInfo = helpInfo;

            // Create the form contents
            InitializeComponent();

            // Update contents to match requirements
            UpdateText();
            UpdateIcon();
            UpdateButtons();
            UpdateDefault();
            UpdateHelp();

            // Finally calculate and set form sizing
            UpdateSizing();
        }
开发者ID:ComponentFactory,项目名称:Krypton,代码行数:27,代码来源:KryptonMessageBox.cs


示例15: smethod_8

 // Token: 0x06002C9D RID: 11421
 // RVA: 0x0012157C File Offset: 0x0011F77C
 public static DialogResult smethod_8(string string_0, MessageBoxButtons messageBoxButtons_0, MessageBoxIcon messageBoxIcon_0)
 {
     Class115.smethod_6(true);
     DialogResult result = MessageBox.Show(string_0, "osu!", messageBoxButtons_0, messageBoxIcon_0);
     Class115.smethod_6(false);
     return result;
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:9,代码来源:Class723.cs


示例16: Log

        public void Log(string Message,MessageBoxIcon WarrningLevel,string StackInfo)
        {
            if (InvokeRequired) {
                // We're not in the UI thread, so we need to call BeginInvoke
                Invoke(new LogDelegate(Log), new object[]{Message,WarrningLevel,StackInfo});
                return;
            }
            //from forms thread
            DateTime date = DateTime.Now;
            string TimeString = date.ToString("H:mm:ss.fff");

            //to file
            string FileName = OutMgfBox.Text+Path.DirectorySeparatorChar+"RawtoMgf.log";
            StreamWriter sw = new StreamWriter(FileName,true);
            string FileMessage = "Info:";
            if (WarrningLevel == MessageBoxIcon.Warning) FileMessage = "Warning!";
            if (WarrningLevel == MessageBoxIcon.Error)   FileMessage = "ERROR!";
            FileMessage += "\t"+TimeString;
            FileMessage += "\t"+Message;
            if (StackInfo != null){
                FileMessage += "\n StackInfo:"+StackInfo;
            }
            sw.WriteLine(FileMessage);
            sw.Close();
            Application.DoEvents();
        }
开发者ID:Quanti-Workflow,项目名称:Quanti-Workflow,代码行数:26,代码来源:Form1.cs


示例17: 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


示例18: 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


示例19: ShowMessage

 protected void ShowMessage(string text, string caption, MessageBoxIcon icon = MessageBoxIcon.None)
 {
     if (XMasterPage != null)
     {
         XMasterPage.ShowMessage(text, caption, icon);
     }
 }
开发者ID:jorik041,项目名称:X.DynamicData,代码行数:7,代码来源:XPage.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MessageBoxImage类代码示例发布时间:2022-05-24
下一篇:
C# MessageBoxForm类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap