Example #1
0
        private void ToolTipWindow_Paint(object sender, PaintEventArgs e)
        {
            BackgroundDecorator.Paint(e.Graphics, this.Handle);

            bool isVisualTheme = Native.IsThemeActive() != 0;

            if (isVisualTheme)
            {
                if (ShowPreview())
                {
                    GraphicsPath gp;
                    using (gp = RoundedRectangle.Create(0, 0, Width - 1, Height - 1, 7))
                    {
                        e.Graphics.DrawPath(Theme.TaskbarTopLine1, gp);
                    }
                    using (gp = RoundedRectangle.Create(1, 1, Width - 3, Height - 3, 7))
                    {
                        e.Graphics.DrawPath(Theme.TaskbarTopLine2, gp);
                    }
                }
                else
                {
                    e.Graphics.DrawRectangle(Theme.TaskbarTopLine1, 0, 0, Width - 1, Height - 1);
                    e.Graphics.DrawRectangle(Theme.TaskbarTopLine2, 1, 1, Width - 3, Height - 3);
                }
            }
            else
            {
                ButtonBorderDecorator.Draw(e.Graphics, 0, 0, Width - 2, Height - 2, false);
            }

            DrawThumbnail();
        }
        private void PaintClassic(PaintEventArgs pevent)
        {
            if (_hover)
            {
                ButtonBorderDecorator.DrawSingle(pevent.Graphics, 0, 0, Width - 1, Height - 1);
            }

            Bitmap arrow = null;

            switch (this.MainForm.TaskbarLocation)
            {
            case DualMonitor.Win32.Native.ABEdge.Left:
                arrow = Properties.Resources.more_classic_right;
                break;

            case DualMonitor.Win32.Native.ABEdge.Top:
                arrow = Properties.Resources.more_classic_down;
                break;

            case DualMonitor.Win32.Native.ABEdge.Right:
                arrow = Properties.Resources.more_classic_left;
                break;

            case DualMonitor.Win32.Native.ABEdge.Bottom:
                arrow = Properties.Resources.more_classic_up;
                break;
            }

            pevent.Graphics.DrawImage(arrow,
                                      (this.Width - arrow.Width) / 2,
                                      (this.Height - arrow.Height) / 2);
        }
        private void DrawClassicButton(PaintEventArgs e)
        {
            int x;
            int y = this.MainForm.TaskbarLocation == Native.ABEdge.Top ? 0 : 2;

            if (IsBig)
            {
                x = (this.Width - DualMonitor.Properties.Resources.start_big_active.Width) / 2;
            }
            else
            {
                x = (this.Width - DualMonitor.Properties.Resources.start_small_hover.Width) / 2;
            }

            if (StartMenuVisible)
            {
                ButtonBorderDecorator.Draw(e.Graphics, x, y, this.Width, this.Height, true);
            }
            else
            {
                ButtonBorderDecorator.Draw(e.Graphics, x, y, this.Width, this.Height, false);
            }

            e.Graphics.DrawString("Start", Font, new SolidBrush(Color.FromKnownColor(KnownColor.ControlText)), 20, 20);
        }
        private void PaintClassic(PaintEventArgs pevent)
        {
            Graphics g = pevent.Graphics;

            base.Paint(g);

            if (!MainForm.IsHidden)
            {
                Pen darkPen    = new Pen(Color.FromKnownColor(KnownColor.ControlDark));
                Pen lighterPen = new Pen(Color.FromKnownColor(KnownColor.ControlLightLight));

                var taskbarLocation = this.MainForm.TaskbarLocation;

                if (taskbarLocation == Native.ABEdge.Bottom ||
                    taskbarLocation == Native.ABEdge.Top)
                {
                    g.DrawLine(darkPen, 0, 0, Width, 0);
                }
                else
                {
                    g.DrawLine(darkPen, 0, 0, 0, Height - 1);
                }

                g.DrawLine(lighterPen, 0, Height - 1, Width, Height - 1);
                g.DrawLine(lighterPen, Width - 1, Height - 1, Width - 1, 0);

                if (Hover)
                {
                    ButtonBorderDecorator.DrawSingle(g, 1, 1, this.Width - 2, this.Height - 2, _isClicked);
                }

                Image image = Properties.Resources.show_desktop_classic;
                Point p     = new Point((this.Width - image.Width) / 2, (this.Height - image.Height) / 2);
                g.DrawImage(image, p);
            }
        }
Example #5
0
        public void Draw()
        {
            if (_mainForm.IsHidden)
            {
                return;
            }

            bool isVisualTheme = Native.IsThemeActive() != 0;

            if (isVisualTheme)
            {
                Bitmap bmp = null;

                switch (_state)
                {
                case State.Normal:
                    bmp = DualMonitor.Properties.Resources.start_big_normal;
                    break;

                case State.Hover:
                    bmp = DualMonitor.Properties.Resources.start_big_hover;
                    break;

                case State.Active:
                    bmp = DualMonitor.Properties.Resources.start_big_active;
                    break;

                default:
                    return;
                }

                using (Bitmap b = new Bitmap(bmp.Width, bmp.Height, PixelFormat.Format32bppArgb))
                {
                    Graphics g = Graphics.FromImage(b);
                    g.DrawImage(bmp, 0, 0);

                    base.SetBitmap(b);
                }
            }
            else
            {
                using (Bitmap b = new Bitmap(this.Width, this.Height, PixelFormat.Format32bppArgb))
                {
                    Graphics g = Graphics.FromImage(b);

                    g.Clear(Color.FromKnownColor(KnownColor.ButtonFace));
                    if (_state == State.Active)
                    {
                        ButtonBorderDecorator.Draw(g, 0, 0, this.Width - 4, this.Height - 2, true);
                    }
                    else
                    {
                        ButtonBorderDecorator.Draw(g, 0, 0, this.Width - 4, this.Height - 2, false);
                    }

                    g.DrawImage(Properties.Resources.start_classic, 1, (this.Height - Properties.Resources.start_classic.Height) / 2);

                    g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;

                    SizeF sizeOfText = g.MeasureString("Start", Font);

                    g.DrawString("Start", Font, new SolidBrush(Color.FromKnownColor(KnownColor.ControlText)), 16, (this.Height - sizeOfText.Height) / 2);

                    base.SetBitmap(b);
                }
            }
        }
Example #6
0
        private void PaintClassic(PaintEventArgs pevent)
        {
            Graphics g = pevent.Graphics;

            base.Paint(g);

            var  taskbarLocation = this.MainForm.TaskbarLocation;
            bool horizontal      = taskbarLocation == Native.ABEdge.Top ||
                                   taskbarLocation == Native.ABEdge.Bottom;

            int spaceAfterX = horizontal ? ButtonConstants.SpaceAfter : 1;
            int spaceAfterY = horizontal ? 0 : ButtonConstants.SpaceAfter;

            if (!horizontal)
            {
                spaceAfterY = -1;
            }

            Pen darkPen    = new Pen(Color.FromKnownColor(KnownColor.ControlDark));
            Pen lighterPen = new Pen(Color.FromKnownColor(KnownColor.ControlLightLight));
            Pen darkerPen  = new Pen(Color.FromKnownColor(KnownColor.ControlDarkDark));
            Pen lightPen   = new Pen(Color.FromKnownColor(KnownColor.ControlLight));

            if (!MainForm.IsHidden)
            {
                // paint background
                ProgressBarDecorator.Paint(g, _buttonBounds, _progress);

                if (_flashActive)
                {
                    g.FillRectangle(new LinearGradientBrush(_buttonBounds, Theme.ButtonFlashBackgroundFrom, Theme.ButtonFlashBackgroundTo, 90f), _buttonBounds);
                }

                if (this.Focused || this._isClicked)
                {
                    if (!_flashActive)
                    {
                        g.FillRectangle(new SolidBrush(Color.FromKnownColor(KnownColor.ButtonHighlight)), _buttonBounds);
                    }

                    #region Border
                    // draw border over background

                    if (this.MainForm.TaskbarLocation == Native.ABEdge.Top)
                    {
                        ButtonBorderDecorator.Draw(g, 0, 3, Width - spaceAfterX - 1, Height - spaceAfterY - 3, true);
                    }
                    else
                    {
                        ButtonBorderDecorator.Draw(g, 0, 4, Width - spaceAfterX - 1, Height - spaceAfterY - 3, true);
                    }
                    #endregion
                }
            }

            if (!this.Focused && !this._isClicked)
            {
                #region Border
                // draw border over background
                if (taskbarLocation == Native.ABEdge.Top)
                {
                    ButtonBorderDecorator.Draw(g, 0, 3, Width - spaceAfterX - 1, Height - spaceAfterY - 3, false);
                }
                else
                {
                    ButtonBorderDecorator.Draw(g, 0, 4, Width - spaceAfterX - 1, Height - spaceAfterY - 3, false);
                }

                #endregion
            }

            if (MainForm.IsHidden)
            {
                return;
            }

            DrawImageAndText(g, horizontal, spaceAfterX, spaceAfterY);
        }
Example #7
0
        private void panelTitle_Paint(object sender, PaintEventArgs e)
        {
            SecondDisplayProcess proc = _button.Tag as SecondDisplayProcess;

            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;

            bool showLivePreview = ShowPreview();

            bool isVisualTheme = Native.IsThemeActive() != 0;

            if (_panelHover)
            {
                if (isVisualTheme)
                {
                    GraphicsPath path = RoundedRectangle.Create(new Rectangle(0, 0, panelTitle.Width - 1, panelTitle.Height - 1), 3, RoundedRectangle.RectangleCorners.All);

                    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

                    e.Graphics.FillPath(Theme.TooltipBackground, path);
                    e.Graphics.DrawPath(Theme.TooltipBorder, path);
                }
                else
                {
                    ButtonBorderDecorator.DrawSingle(e.Graphics, 0, 0, panelTitle.Width - 1, panelTitle.Height - 1);
                }

                if (_overCloseButton)
                {
                    _closeForm.Draw(DualMonitor.Properties.Resources.close_hover);
                }
                else
                {
                    _closeForm.Draw(DualMonitor.Properties.Resources.close);
                }
            }

            if (proc == null)
            {
                return;
            }

            if (!showLivePreview)
            {
                if (proc.SmallIcon != null)
                {
                    e.Graphics.DrawIcon(proc.SmallIcon, new Rectangle(ThumbnailConstants.IconMargin, 9, ThumbnailConstants.IconSize, ThumbnailConstants.IconSize));
                }

                if (proc.Title != null)
                {
                    e.Graphics.DrawString(proc.Title, this.Font, _fontColor,
                                          new RectangleF(ThumbnailConstants.LiveIconMargin + 5 + ThumbnailConstants.IconSize, 9f, panelTitle.Width - (ThumbnailConstants.IconMargin + 5 + ThumbnailConstants.IconSize) * 2, this.Font.Height),
                                          _appTitleStringFormat);
                }
            }
            else
            {
                if (proc.SmallIcon != null)
                {
                    e.Graphics.DrawIcon(proc.SmallIcon, new Rectangle(ThumbnailConstants.LiveIconMargin, 7, ThumbnailConstants.IconSize, ThumbnailConstants.IconSize));
                }

                if (proc.Title != null)
                {
                    e.Graphics.DrawString(proc.Title, this.Font, _fontColor,
                                          new RectangleF(ThumbnailConstants.LiveIconMargin + 5 + ThumbnailConstants.IconSize, 9f, panelTitle.Width - (ThumbnailConstants.LiveIconMargin + 5 + ThumbnailConstants.IconSize) * 2, this.Font.Height),
                                          _appTitleStringFormat);
                }
            }
        }