示例#1
0
        static void ShowNotifier(string title, string message, string imageFilename, Action <object, EventArgs> titleClick = null, Action <object, EventArgs> contentClick = null
                                 , bool keepVisibleOnMouseOver = true, bool reshowOnMouseOver = true, int delayShowingInMilliSec = 500, int delayStayingInMilliSec = 3000, int delayHidingInMilliSec = 500
                                 , string closeImageFilename   = null, Action <object, EventArgs> closeClick = null)
        {
            TaskbarNotifier taskbarNotifier = new TaskbarNotifier();

            taskbarNotifier.SetBackgroundBitmap(new Bitmap(taskbarNotifier.GetType(), imageFilename), Color.FromArgb(255, 0, 255));
            if (closeImageFilename != null || closeImageFilename.Length > 0)
            {
                taskbarNotifier.SetCloseBitmap(new Bitmap(taskbarNotifier.GetType(), closeImageFilename), Color.FromArgb(255, 0, 255), new Point(127, 8));
            }
            taskbarNotifier.TitleRectangle   = new Rectangle(40, 9, 70, 25);
            taskbarNotifier.ContentRectangle = new Rectangle(8, 41, 133, 68);
            if (titleClick != null)
            {
                taskbarNotifier.TitleClick    += new EventHandler(titleClick);
                taskbarNotifier.TitleClickable = true;
            }
            else
            {
                taskbarNotifier.TitleClickable = false;
            }
            if (contentClick != null)
            {
                taskbarNotifier.ContentClick    += new EventHandler(contentClick);
                taskbarNotifier.ContentClickable = true;
            }
            else
            {
                taskbarNotifier.ContentClickable = false;
            }
            if (closeClick != null)
            {
                taskbarNotifier.CloseClick    += new EventHandler(closeClick);
                taskbarNotifier.CloseClickable = true;
            }
            else
            {
                taskbarNotifier.CloseClickable = false;
            }

            taskbarNotifier.KeepVisibleOnMousOver = keepVisibleOnMouseOver;
            taskbarNotifier.ReShowOnMouseOver     = reshowOnMouseOver;

            taskbarNotifier.Show(title, message, delayShowingInMilliSec, delayStayingInMilliSec, delayHidingInMilliSec);
        }
        static void ShowNotifier(string title, string message, string imageFilename, Action<object, EventArgs> titleClick = null, Action<object, EventArgs> contentClick = null
            , bool keepVisibleOnMouseOver = true, bool reshowOnMouseOver = true, int delayShowingInMilliSec = 500, int delayStayingInMilliSec = 3000, int delayHidingInMilliSec = 500
            , string closeImageFilename = null, Action<object, EventArgs> closeClick=null)
        {
            TaskbarNotifier taskbarNotifier = new TaskbarNotifier();
            taskbarNotifier.SetBackgroundBitmap(new Bitmap(taskbarNotifier.GetType(), imageFilename), Color.FromArgb(255, 0, 255));
            if(closeImageFilename!=null || closeImageFilename.Length>0)
                taskbarNotifier.SetCloseBitmap(new Bitmap(taskbarNotifier.GetType(), closeImageFilename), Color.FromArgb(255, 0, 255), new Point(127, 8));
            taskbarNotifier.TitleRectangle = new Rectangle(40, 9, 70, 25);
            taskbarNotifier.ContentRectangle = new Rectangle(8, 41, 133, 68);
            if (titleClick != null)
            {
                taskbarNotifier.TitleClick += new EventHandler(titleClick);
                taskbarNotifier.TitleClickable = true;
            }
            else
                taskbarNotifier.TitleClickable = false;
            if (contentClick != null)
            {
                taskbarNotifier.ContentClick += new EventHandler(contentClick);
                taskbarNotifier.ContentClickable = true;
            }
            else
                taskbarNotifier.ContentClickable = false;
            if (closeClick != null)
            {
                taskbarNotifier.CloseClick += new EventHandler(closeClick);
                taskbarNotifier.CloseClickable = true;
            }
            else
                taskbarNotifier.CloseClickable = false;

            taskbarNotifier.KeepVisibleOnMousOver = keepVisibleOnMouseOver;	
            taskbarNotifier.ReShowOnMouseOver = reshowOnMouseOver;	
		    
			taskbarNotifier.Show(title,message,delayShowingInMilliSec,delayStayingInMilliSec,delayHidingInMilliSec);
        }