Exemplo n.º 1
0
        public frmNotifyWindow()
        {
            SetStyle(ControlStyles.UserMouse, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);                         // WmPaint calls OnPaint and OnPaintBackground
            SetStyle(ControlStyles.DoubleBuffer, true);

            ShowInTaskbar   = false;
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            StartPosition   = System.Windows.Forms.FormStartPosition.Manual;
            TopMost         = true;

            // Default values
            BackgroundStyle = BackgroundStyles.VerticalGradient;
            ClockState      = ClockStates.None;
            BackColor       = Color.WhiteSmoke;
            GradientColor   = Color.LightCyan;
            PressedColor    = Color.Gray;
            TitleColor      = SystemColors.ControlText;
            TextColor       = SystemColors.ControlText;
            WaitOnMouseOver = true;
            ActualWidth     = 250;
            ActualHeight    = 80;
            WaitTime        = 6000;
        }
Exemplo n.º 2
0
            /// <param name="title">Title text displayed in the NotifyWindow</param>
            /// <param name="text">Main text displayedin the NotifyWindow</param>
            public NotifyWindow(string text, string title = null)
            {
                Title = title;
                Text  = text;

                SetStyle(ControlStyles.UserMouse, true);
                SetStyle(ControlStyles.UserPaint, true);
                SetStyle(ControlStyles.AllPaintingInWmPaint, true);             // WmPaint calls OnPaint and OnPaintBackground
                SetStyle(ControlStyles.DoubleBuffer, true);

                ShowInTaskbar   = false;
                FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                StartPosition   = System.Windows.Forms.FormStartPosition.Manual;

                // Default values
                BackgroundStyle = BackgroundStyles.VerticalGradient;
                ClockState      = ClockStates.None;
                BackColor       = Color.SteelBlue;
                GradientColor   = Color.WhiteSmoke;
                PressedColor    = Color.Gray;
                TitleColor      = SystemColors.ControlText;
                TextColor       = SystemColors.ControlText;
                WaitOnMouseOver = true;
                ActualWidth     = 130;
                ActualHeight    = 110;
                WaitTime        = 10000;
            }
Exemplo n.º 3
0
 public NotifyWindow()
 {
     this.closePressed = false;
     this.textPressed = false;
     this.titlePressed = false;
     this.closeHot = false;
     this.textHot = false;
     this.titleHot = false;
     base.SetStyle(ControlStyles.UserMouse, true);
     base.SetStyle(ControlStyles.UserPaint, true);
     base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     base.SetStyle(ControlStyles.DoubleBuffer, true);
     base.ShowInTaskbar = false;
     base.FormBorderStyle = FormBorderStyle.None;
     base.StartPosition = FormStartPosition.Manual;
     this.BackgroundStyle = BackgroundStyles.VerticalGradient;
     this.ClockState = ClockStates.None;
     this.BackColor = Color.SteelBlue;
     this.GradientColor = Color.WhiteSmoke;
     this.PressedColor = Color.Gray;
     this.TitleColor = SystemColors.ControlText;
     this.TextColor = SystemColors.ControlText;
     this.WaitOnMouseOver = true;
     this.ActualWidth = 130;
     this.ActualHeight = 110;
     this.WaitTime = 0x2af8;
 }
Exemplo n.º 4
0
 public NotifyWindow()
 {
     this.closePressed = false;
     this.textPressed  = false;
     this.titlePressed = false;
     this.closeHot     = false;
     this.textHot      = false;
     this.titleHot     = false;
     base.SetStyle(ControlStyles.UserMouse, true);
     base.SetStyle(ControlStyles.UserPaint, true);
     base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     base.SetStyle(ControlStyles.DoubleBuffer, true);
     base.ShowInTaskbar   = false;
     base.FormBorderStyle = FormBorderStyle.None;
     base.StartPosition   = FormStartPosition.Manual;
     this.BackgroundStyle = BackgroundStyles.VerticalGradient;
     this.ClockState      = ClockStates.None;
     this.BackColor       = Color.SteelBlue;
     this.GradientColor   = Color.WhiteSmoke;
     this.PressedColor    = Color.Gray;
     this.TitleColor      = SystemColors.ControlText;
     this.TextColor       = SystemColors.ControlText;
     this.WaitOnMouseOver = true;
     this.ActualWidth     = 130;
     this.ActualHeight    = 110;
     this.WaitTime        = 0x2af8;
 }
Exemplo n.º 5
0
        protected void viewTimer(object sender, System.EventArgs e)
        {
            switch (ClockState)
            {
            case ClockStates.Opening:
                if (Top - 2 <= rScreen.Height - ActualHeight)
                {
                    Top        = rScreen.Height - ActualHeight;
                    Height     = ActualHeight;
                    ClockState = ClockStates.Showing;
                    svTime     = DateTime.Now;
                    if (hKeyboardHook != 0 && hMouseHook != 0 && Sticky)
                    {
                        waiting = true;
                    }
                    viewClock.Interval = 11000;
                }
                else
                {
                    Top    -= 2;
                    Height += 2;
                }
                break;

            case ClockStates.Showing:
                if (!waiting || (MaxMinutes > 0 && DateTime.Now.CompareTo(svTime.AddMinutes(MaxMinutes)) > 0))
                {
                    viewClock.Interval = 5000;
                    ClockState         = ClockStates.CloseReady;
                }
                break;

            case ClockStates.CloseReady:
                if (WaitOnMouseOver || !rGlobDisplay.Contains(Cursor.Position))
                {
                    viewClock.Interval = 1;
                    ClockState         = ClockStates.Closing;
                }
                break;

            case ClockStates.Closing:
                Top    += 2;
                Height -= 2;
                if (Top >= rScreen.Height)
                {
                    ClockState = ClockStates.None;
                    viewClock.Stop();
                    viewClock.Dispose();
                    Close();
                }
                break;
            }
        }
Exemplo n.º 6
0
        protected void viewTimer(object sender, System.EventArgs e)
        {
            switch (ClockState)
            {
            case ClockStates.Opening:
                //if (Top - 2 <= rScreen.Height - ActualHeight)
                if (Top - 2 <= VirtualHeight - ActualHeight)
                {
                    //Top = rScreen.Height - ActualHeight;
                    Top                = VirtualHeight - ActualHeight;
                    Height             = ActualHeight;
                    ClockState         = ClockStates.Showing;
                    viewClock.Interval = WaitTime;
                }
                else
                {
                    Top    -= 2;
                    Height += 2;
                }

                IsShow = true;

                break;

            case ClockStates.Showing:
                if (!WaitOnMouseOver || !rGlobDisplay.Contains(Cursor.Position))
                {
                    viewClock.Interval = 1;
                    ClockState         = ClockStates.Closing;
                }

                IsShow = true;

                break;

            case ClockStates.Closing:
                Top    += 2;
                Height -= 2;
                //if (Top >= rScreen.Height)
                if (Top >= VirtualHeight)
                {
                    ClockState = ClockStates.None;
                    viewClock.Stop();
                    viewClock.Dispose();
                    Close();

                    IsShow = false;
                }

                break;
            }
        }
Exemplo n.º 7
0
        public NotifyWindow()
        {
            SetStyle(ControlStyles.UserMouse, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);                         // WmPaint calls OnPaint and OnPaintBackground
            SetStyle(ControlStyles.DoubleBuffer, true);

            ShowInTaskbar   = false;
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            StartPosition   = System.Windows.Forms.FormStartPosition.Manual;

            //Default values

            ClockState      = ClockStates.None;
            BackColor       = Color.SteelBlue;
            WaitOnMouseOver = true;
            ActualWidth     = 130;
            ActualHeight    = 110;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Displays the NotifyWindow.
        /// </summary>
        public void Notify()
        {
            //if (Text == null || Text.Length < 1)
            //	throw new System.Exception ("You must set NotifyWindow.Text before calling Notify()");

            Width   = ActualWidth;
            rScreen = Screen.GetWorkingArea(Screen.PrimaryScreen.Bounds);
            Height  = 0;
            Top     = rScreen.Bottom;
            Left    = rScreen.Width - Width - 11;

            rDisplay = new Rectangle(0, 0, Width, ActualHeight);
            rClose   = new Rectangle(Width - 21, 10, 13, 13);

            // rGlob* are Rectangle's Offset'ed to their actual position on the screen, for use with Cursor.Position.
            rGlobClose = rClose;
            rGlobClose.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobText = rText;
            rGlobText.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobTitle = rTitle;
            if (Title != null)
            {
                rGlobTitle.Offset(Left, rScreen.Bottom - ActualHeight);
            }
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobClose = rClose;
            rGlobClose.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset(Left, rScreen.Bottom - ActualHeight);

            // Use unmanaged ShowWindow() and SetWindowPos() instead of the managed Show() to display the window - this method will display
            // the window TopMost, but without stealing focus (namely the SW_SHOWNOACTIVATE and SWP_NOACTIVATE flags)
            ShowWindow(Handle, SW_SHOWNOACTIVATE);
            SetWindowPos(Handle, HWND_TOPMOST, rScreen.Width - ActualWidth - 11, rScreen.Bottom, ActualWidth, 0, SWP_NOACTIVATE);

            viewClock          = new System.Windows.Forms.Timer();
            viewClock.Tick    += new System.EventHandler(viewTimer);
            viewClock.Interval = 1;
            viewClock.Start();

            ClockState = ClockStates.Opening;
        }
        protected void viewTimer(object sender, System.EventArgs e)
        {
            switch (ClockState)
            {
            case ClockStates.Opening:
                if (Top - 2 <= rScreen.Height - ActualHeight)
                {
                    Top                = rScreen.Height - ActualHeight;
                    Height             = ActualHeight;
                    ClockState         = ClockStates.Showing;
                    viewClock.Interval = WaitTime;
                }
                else
                {
                    Top    -= 2;
                    Height += 2;
                }
                break;

            case ClockStates.Showing:
                if (!WaitOnMouseOver || !rGlobDisplay.Contains(Cursor.Position))
                {
                    viewClock.Interval = 1;
                    ClockState         = ClockStates.Closing;
                }
                break;

            case ClockStates.Closing:
                Top    += 2;
                Height -= 2;
                if (Top >= rScreen.Height)
                {
                    ClockState = ClockStates.None;
                    viewClock.Stop();
                    viewClock.Dispose();
                    Close();
                    //System.Threading.Thread.Sleep(3000);
                    RobertMisiak.NotifyWindow.IsBusy = false;
                }
                break;
            }
        }
Exemplo n.º 10
0
        protected void viewTimer(object sender, EventArgs e)
        {
            switch (this.ClockState)
            {
            case ClockStates.Opening:
                if ((base.Top - 2) > (this.rScreen.Height - this.ActualHeight))
                {
                    base.Top    -= 2;
                    base.Height += 2;
                    return;
                }
                base.Top                = this.rScreen.Height - this.ActualHeight;
                base.Height             = this.ActualHeight;
                this.ClockState         = ClockStates.Showing;
                this.viewClock.Interval = this.WaitTime;
                return;

            case ClockStates.Closing:
                base.Top    += 2;
                base.Height -= 2;
                if (base.Top >= this.rScreen.Height)
                {
                    this.ClockState = ClockStates.None;
                    this.viewClock.Stop();
                    this.viewClock.Dispose();
                    base.Close();
                    return;
                }
                return;

            case ClockStates.Showing:
                if (!this.WaitOnMouseOver || !this.rGlobDisplay.Contains(Cursor.Position))
                {
                    this.viewClock.Interval = 1;
                    this.ClockState         = ClockStates.Closing;
                    return;
                }
                return;
            }
        }
Exemplo n.º 11
0
        public NotifyWindow2000()
        {
            SetStyle(ControlStyles.UserMouse, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            ShowInTaskbar   = false;
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            StartPosition   = System.Windows.Forms.FormStartPosition.Manual;

            // Defaults
            BackgroundStyle = BackgroundStyles.VerticalGradient;
            ClockState      = ClockStates.None;
            BackColor       = Color.SteelBlue;
            GradientColor   = Color.WhiteSmoke;
            PressedColor    = Color.Gray;
            Sticky          = true;
            WaitOnMouseOver = false;
            MaxMinutes      = 30;
            ActualWidth     = 130;
            ActualHeight    = 110;
        }
Exemplo n.º 12
0
        protected void viewTimer(object sender, System.EventArgs e)
        {
            switch (ClockState)
            {
                case ClockStates.Opening:
                    if (Top - 2 <= rScreen.Height - ActualHeight)
                    {
                        Top = rScreen.Height - ActualHeight;
                        Height = ActualHeight;
                        ClockState = ClockStates.Showing;
                        viewClock.Interval = WaitTime;
                    }
                    else
                    {
                        Top -= 2;
                        Height += 2;
                    }
                    break;

                case ClockStates.Showing:
                    if (!WaitOnMouseOver || !rGlobDisplay.Contains (Cursor.Position))
                    {
                        viewClock.Interval = 1;
                        ClockState = ClockStates.Closing;
                    }
                    break;

                case ClockStates.Closing:
                    Top += 2;
                    Height -= 2;
                    if (Top >= rScreen.Height)
                    {
                        ClockState = ClockStates.None;
                        viewClock.Stop();
                        viewClock.Dispose();
                        Close();
                    }
                    break;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Displays the NotifyWindow.
        /// </summary>
        public void Notify()
        {
            if (Text == null || Text.Length < 1)
                throw new System.Exception ("You must set NotifyWindow.Text before calling Notify()");

            Width = ActualWidth;
            rScreen = Screen.GetWorkingArea (Screen.PrimaryScreen.Bounds);
            Height = 0;
            Top = rScreen.Bottom;
            Left = rScreen.Width - Width - 11;

            if (HoverFont == null)
                HoverFont = new Font (Font, Font.Style | FontStyle.Underline);
            if (TitleFont == null)
                TitleFont = Font;
            if (TitleHoverFont == null)
                TitleHoverFont = new Font (TitleFont, TitleFont.Style | FontStyle.Underline);
            if (this.StringFormat == null)
            {
                this.StringFormat = new StringFormat();
                this.StringFormat.Alignment = StringAlignment.Center;
                this.StringFormat.LineAlignment = StringAlignment.Center;
                this.StringFormat.Trimming = StringTrimming.EllipsisWord;
            }

            rDisplay = new Rectangle (0, 0, Width, ActualHeight);
            rClose = new Rectangle (Width - 21, 10, 13, 13);

            int offset;
            if (Title != null)
            {
                using (Graphics fx = CreateGraphics())
                {
                    SizeF sz = fx.MeasureString (Title, TitleFont, ActualWidth - rClose.Width - 22, this.StringFormat);
                    rTitle = new Rectangle (11, 12, (int) Math.Ceiling (sz.Width), (int) Math.Ceiling (sz.Height));
                    offset = (int) Math.Max (Math.Ceiling (sz.Height + rTitle.Top + 2), rClose.Bottom + 5);
                }
            }
            else
            {
                offset = rClose.Bottom + 1;
                rTitle = new Rectangle (-1, -1, 1, 1);
            }

            rText = new Rectangle (11, offset, ActualWidth - 22, ActualHeight - (int)(offset * 1.5));
            // rGlob* are Rectangle's Offset'ed to their actual position on the screen, for use with Cursor.Position.
            rGlobClose = rClose;
            rGlobClose.Offset (Left, rScreen.Bottom - ActualHeight);
            rGlobText = rText;
            rGlobText.Offset (Left, rScreen.Bottom - ActualHeight);
            rGlobTitle = rTitle;
            if (Title != null)
                rGlobTitle.Offset (Left, rScreen.Bottom - ActualHeight);
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset (Left, rScreen.Bottom - ActualHeight);
            rGlobClose = rClose;
            rGlobClose.Offset (Left, rScreen.Bottom - ActualHeight);
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset (Left, rScreen.Bottom - ActualHeight);

            // Use unmanaged ShowWindow() and SetWindowPos() instead of the managed Show() to display the window - this method will display
            // the window TopMost, but without stealing focus (namely the SW_SHOWNOACTIVATE and SWP_NOACTIVATE flags)
            ShowWindow (Handle, SW_SHOWNOACTIVATE);
            SetWindowPos (Handle, HWND_TOPMOST, rScreen.Width - ActualWidth - 11, rScreen.Bottom, ActualWidth, 0, SWP_NOACTIVATE);

            viewClock = new System.Windows.Forms.Timer();
            viewClock.Tick += new System.EventHandler (viewTimer);
            viewClock.Interval = 1;
            viewClock.Start();

            ClockState = ClockStates.Opening;
        }
Exemplo n.º 14
0
        protected void viewTimer(object sender, EventArgs e)
        {
            switch (this.ClockState)
            {
                case ClockStates.Opening:
                    if ((base.Top - 2) > (this.rScreen.Height - this.ActualHeight))
                    {
                        base.Top -= 2;
                        base.Height += 2;
                        break;
                    }
                    base.Top = this.rScreen.Height - this.ActualHeight;
                    base.Height = this.ActualHeight;
                    this.ClockState = ClockStates.Showing;
                    this.viewClock.Interval = this.WaitTime;
                    break;

                case ClockStates.Closing:
                    base.Top += 2;
                    base.Height -= 2;
                    if (base.Top >= this.rScreen.Height)
                    {
                        this.ClockState = ClockStates.None;
                        this.viewClock.Stop();
                        this.viewClock.Dispose();
                        base.Close();
                    }
                    break;

                case ClockStates.Showing:
                    if (!(this.WaitOnMouseOver && this.rGlobDisplay.Contains(Cursor.Position)))
                    {
                        this.viewClock.Interval = 1;
                        this.ClockState = ClockStates.Closing;
                    }
                    break;
            }
        }
Exemplo n.º 15
0
        public void Notify()
        {
            if (Text == null || Text.Length < 1)
            {
                throw new System.Exception("You must set NotifyWindow.Text before calling Notify()");
            }

            hpMouse    = new HOOKPROC(mouseHookProc);
            hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, hpMouse,
                                          Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
            if (Sticky)
            {
                hpKeyboard    = new HOOKPROC(keyboardHookProc);
                hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, hpKeyboard,
                                                 Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);
            }

            Width   = ActualWidth;
            rScreen = Screen.GetWorkingArea(Screen.PrimaryScreen.Bounds);
            Height  = 0;
            Top     = rScreen.Bottom;
            Left    = rScreen.Width - Width - 11;

            if (HoverFont == null)
            {
                HoverFont = new Font(Font, FontStyle.Underline);
            }
            if (TitleFont == null)
            {
                TitleFont = Font;
            }
            if (TitleHoverFont == null)
            {
                TitleHoverFont = new Font(TitleFont, FontStyle.Underline);
            }
            if (this.StringFormat == null)
            {
                this.StringFormat               = new StringFormat();
                this.StringFormat.Alignment     = StringAlignment.Center;
                this.StringFormat.LineAlignment = StringAlignment.Center;
                this.StringFormat.Trimming      = StringTrimming.EllipsisWord;
            }

            rDisplay = new Rectangle(0, 0, Width, ActualHeight);
            rClose   = new Rectangle(Width - 21, 10, 13, 13);

            int offset;

            if (Title != null)
            {
                using (Graphics fx = CreateGraphics())
                {
                    SizeF sz = fx.MeasureString(Title, TitleFont, ActualWidth - rClose.Width - 22, this.StringFormat);
                    rTitle = new Rectangle(11, 15, (int)Math.Ceiling(sz.Width), (int)Math.Ceiling(sz.Height));
                    offset = (int)Math.Max(Math.Ceiling(sz.Height + rTitle.Top + 2), rClose.Bottom + 5);
                }
            }
            else
            {
                offset = rClose.Bottom + 1;
                rTitle = new Rectangle(-1, -1, 1, 1);
            }

            rText      = new Rectangle(11, offset, ActualWidth - 22, ActualHeight - (int)(offset * 1.5));
            rGlobClose = rClose;
            rGlobClose.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobText = rText;
            rGlobText.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobTitle = rTitle;
            if (Title != null)
            {
                rGlobTitle.Offset(Left, rScreen.Bottom - ActualHeight);
            }
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobClose = rClose;
            rGlobClose.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset(Left, rScreen.Bottom - ActualHeight);

            // Use unmanaged ShowWindow() and SetWindowPos() instead of the managed Show() to display the window - this method will display
            // the window TopMost, but without stealing focus (namely the SW_SHOWNOACTIVATE and SWP_NOACTIVATE flags)
            ShowWindow(Handle, SW_SHOWNOACTIVATE);
            SetWindowPos(Handle, HWND_TOPMOST, rScreen.Width - ActualWidth - 11, rScreen.Bottom, ActualWidth, 0, SWP_NOACTIVATE);

            viewClock          = new System.Windows.Forms.Timer();
            viewClock.Tick    += new System.EventHandler(viewTimer);
            viewClock.Interval = 1;
            viewClock.Start();

            ClockState = ClockStates.Opening;
        }
Exemplo n.º 16
0
        public void Notify()
        {
            int num;

            if ((this.Text == null) || (this.Text.Length < 1))
            {
                throw new Exception("You must set NotifyWindow.Text before calling Notify()");
            }
            base.Width   = this.ActualWidth;
            this.rScreen = Screen.GetWorkingArea(Screen.PrimaryScreen.Bounds);
            base.Height  = 0;
            base.Top     = this.rScreen.Bottom;
            base.Left    = (this.rScreen.Width - base.Width) - 11;
            if (this.HoverFont == null)
            {
                this.HoverFont = new Font(this.Font, this.Font.Style | FontStyle.Underline);
            }
            if (this.TitleFont == null)
            {
                this.TitleFont = this.Font;
            }
            if (this.TitleHoverFont == null)
            {
                this.TitleHoverFont = new Font(this.TitleFont, this.TitleFont.Style | FontStyle.Underline);
            }
            if (this.StringFormat == null)
            {
                this.StringFormat               = new System.Drawing.StringFormat();
                this.StringFormat.Alignment     = StringAlignment.Center;
                this.StringFormat.LineAlignment = StringAlignment.Center;
                this.StringFormat.Trimming      = StringTrimming.EllipsisWord;
            }
            this.rDisplay = new Rectangle(0, 0, base.Width, this.ActualHeight);
            this.rClose   = new Rectangle(base.Width - 0x15, 10, 13, 13);
            if (this.Title != null)
            {
                using (Graphics graphics = base.CreateGraphics())
                {
                    SizeF ef = graphics.MeasureString(this.Title, this.TitleFont, (int)((this.ActualWidth - this.rClose.Width) - 0x16), this.StringFormat);
                    this.rTitle = new Rectangle(11, 12, (int)Math.Ceiling((double)ef.Width), (int)Math.Ceiling((double)ef.Height));
                    num         = (int)Math.Max(Math.Ceiling((double)((ef.Height + this.rTitle.Top) + 2.0)), (double)(this.rClose.Bottom + 5));
                    goto Label_020C;
                }
            }
            num         = this.rClose.Bottom + 1;
            this.rTitle = new Rectangle(-1, -1, 1, 1);
Label_020C:
            this.rText      = new Rectangle(11, num, this.ActualWidth - 0x16, this.ActualHeight - ((int)(num * 1.5)));
            this.rGlobClose = this.rClose;
            this.rGlobClose.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
            this.rGlobText = this.rText;
            this.rGlobText.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
            this.rGlobTitle = this.rTitle;
            if (this.Title != null)
            {
                this.rGlobTitle.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
            }
            this.rGlobDisplay = this.rDisplay;
            this.rGlobDisplay.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
            this.rGlobClose = this.rClose;
            this.rGlobClose.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
            this.rGlobDisplay = this.rDisplay;
            this.rGlobDisplay.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
            ShowWindow(base.Handle, 4);
            SetWindowPos(base.Handle, -1, (this.rScreen.Width - this.ActualWidth) - 11, this.rScreen.Bottom, this.ActualWidth, 0, 0x10);
            this.viewClock          = new System.Windows.Forms.Timer();
            this.viewClock.Tick    += new EventHandler(this.viewTimer);
            this.viewClock.Interval = 1;
            this.viewClock.Start();
            this.ClockState = ClockStates.Opening;
        }
Exemplo n.º 17
0
        public NotifyWindow()
        {
            SetStyle (ControlStyles.UserMouse, true);
            SetStyle (ControlStyles.UserPaint, true);
            SetStyle (ControlStyles.AllPaintingInWmPaint, true);		// WmPaint calls OnPaint and OnPaintBackground
            SetStyle (ControlStyles.DoubleBuffer, true);

            ShowInTaskbar = false;
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            StartPosition = System.Windows.Forms.FormStartPosition.Manual;

            // Default values
            BackgroundStyle = BackgroundStyles.VerticalGradient;
            ClockState = ClockStates.None;
            BackColor = Color.SteelBlue;
            GradientColor = Color.WhiteSmoke;
            PressedColor = Color.Gray;
            TitleColor = SystemColors.ControlText;
            TextColor = SystemColors.ControlText;
            WaitOnMouseOver = true;
            ActualWidth = 130;
            ActualHeight = 110;
            WaitTime = 11000;
        }
Exemplo n.º 18
0
        /// <summary>
        /// Displays the UserNotifyForm.
        /// </summary>
        public void Notify()
        {
            if (Text == null || Text.Length < 1)
            {
                throw new System.Exception("You must set UserNotifyForm.Text before calling Notify()");
            }

            Width   = ActualWidth;
            rScreen = Screen.GetWorkingArea(Screen.PrimaryScreen.Bounds);
            Height  = 0;
            Top     = rScreen.Bottom;
            Left    = rScreen.Width - Width - 11;

            if (HoverFont == null)
            {
                HoverFont = new Font(Font, Font.Style | FontStyle.Underline);
            }
            if (TitleFont == null)
            {
                TitleFont = Font;
            }
            if (TitleHoverFont == null)
            {
                TitleHoverFont = new Font(TitleFont, TitleFont.Style | FontStyle.Underline);
            }
            if (this.StringFormat == null)
            {
                this.StringFormat               = new StringFormat();
                this.StringFormat.Alignment     = StringAlignment.Center;
                this.StringFormat.LineAlignment = StringAlignment.Center;
                this.StringFormat.Trimming      = StringTrimming.EllipsisWord;
            }

            rDisplay = new Rectangle(0, 0, Width, ActualHeight);
            rClose   = new Rectangle(Width - 21, 10, 13, 13);

            int offset;

            if (Title != null)
            {
                using (Graphics fx = CreateGraphics())
                {
                    SizeF sz = fx.MeasureString(Title, TitleFont, ActualWidth - rClose.Width - 22, this.StringFormat);
                    rTitle = new Rectangle(11, 12, (int)Math.Ceiling(sz.Width), (int)Math.Ceiling(sz.Height));
                    offset = (int)Math.Max(Math.Ceiling(sz.Height + rTitle.Top + 2), rClose.Bottom + 5);
                }
            }
            else
            {
                offset = rClose.Bottom + 1;
                rTitle = new Rectangle(-1, -1, 1, 1);
            }

            rText = new Rectangle(11, offset, ActualWidth - 22, ActualHeight - (int)(offset * 1.5));
            // rGlob* are Rectangle's Offset'ed to their actual position on the screen, for use with Cursor.Position.
            rGlobClose = rClose;
            rGlobClose.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobText = rText;
            rGlobText.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobTitle = rTitle;
            if (Title != null)
            {
                rGlobTitle.Offset(Left, rScreen.Bottom - ActualHeight);
            }
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobClose = rClose;
            rGlobClose.Offset(Left, rScreen.Bottom - ActualHeight);
            rGlobDisplay = rDisplay;
            rGlobDisplay.Offset(Left, rScreen.Bottom - ActualHeight);

            // Use unmanaged ShowWindow() and SetWindowPos() instead of the managed Show() to display the window - this method will display
            // the window TopMost, but without stealing focus (namely the SW_SHOWNOACTIVATE and SWP_NOACTIVATE flags)
            ShowWindow(Handle, SW_SHOWNOACTIVATE);
            SetWindowPos(Handle, HWND_TOPMOST, rScreen.Width - ActualWidth - 11, rScreen.Bottom, ActualWidth, 0, SWP_NOACTIVATE);

            viewClock          = new System.Windows.Forms.Timer();
            viewClock.Tick    += new System.EventHandler(viewTimer);
            viewClock.Interval = 1;
            viewClock.Start();

            ClockState = ClockStates.Opening;
        }
Exemplo n.º 19
0
 public void Notify()
 {
     int num;
     if ((this.Text == null) || (this.Text.Length < 1))
     {
         throw new Exception("You must set NotifyWindow.Text before calling Notify()");
     }
     base.Width = this.ActualWidth;
     this.rScreen = Screen.GetWorkingArea(Screen.PrimaryScreen.Bounds);
     base.Height = 0;
     base.Top = this.rScreen.Bottom;
     base.Left = (this.rScreen.Width - base.Width) - 11;
     if (this.HoverFont == null)
     {
         this.HoverFont = new Font(this.Font, this.Font.Style | FontStyle.Underline);
     }
     if (this.TitleFont == null)
     {
         this.TitleFont = this.Font;
     }
     if (this.TitleHoverFont == null)
     {
         this.TitleHoverFont = new Font(this.TitleFont, this.TitleFont.Style | FontStyle.Underline);
     }
     if (this.StringFormat == null)
     {
         this.StringFormat = new System.Drawing.StringFormat();
         this.StringFormat.Alignment = StringAlignment.Center;
         this.StringFormat.LineAlignment = StringAlignment.Center;
         this.StringFormat.Trimming = StringTrimming.EllipsisWord;
     }
     this.rDisplay = new Rectangle(0, 0, base.Width, this.ActualHeight);
     this.rClose = new Rectangle(base.Width - 0x15, 10, 13, 13);
     if (this.Title != null)
     {
         using (Graphics graphics = base.CreateGraphics())
         {
             SizeF ef = graphics.MeasureString(this.Title, this.TitleFont, (int) ((this.ActualWidth - this.rClose.Width) - 0x16), this.StringFormat);
             this.rTitle = new Rectangle(11, 12, (int) Math.Ceiling((double) ef.Width), (int) Math.Ceiling((double) ef.Height));
             num = (int) Math.Max(Math.Ceiling((double) ((ef.Height + this.rTitle.Top) + 2f)), (double) (this.rClose.Bottom + 5));
         }
     }
     else
     {
         num = this.rClose.Bottom + 1;
         this.rTitle = new Rectangle(-1, -1, 1, 1);
     }
     this.rText = new Rectangle(11, num, this.ActualWidth - 0x16, this.ActualHeight - ((int) (num * 1.5)));
     this.rGlobClose = this.rClose;
     this.rGlobClose.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
     this.rGlobText = this.rText;
     this.rGlobText.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
     this.rGlobTitle = this.rTitle;
     if (this.Title != null)
     {
         this.rGlobTitle.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
     }
     this.rGlobDisplay = this.rDisplay;
     this.rGlobDisplay.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
     this.rGlobClose = this.rClose;
     this.rGlobClose.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
     this.rGlobDisplay = this.rDisplay;
     this.rGlobDisplay.Offset(base.Left, this.rScreen.Bottom - this.ActualHeight);
     ShowWindow(base.Handle, 4);
     SetWindowPos(base.Handle, -1, (this.rScreen.Width - this.ActualWidth) - 11, this.rScreen.Bottom, this.ActualWidth, 0, 0x10);
     this.viewClock = new Timer();
     this.viewClock.Tick += new EventHandler(this.viewTimer);
     this.viewClock.Interval = 1;
     this.viewClock.Start();
     this.ClockState = ClockStates.Opening;
 }