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 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);
            }
        }
예제 #3
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);
                }
            }
        }