Andwho.Windows.Forms.Metro.MetroForm.DrawStart C# (CSharp) Метод

DrawStart() приватный Метод

绘制开始菜单UI
private DrawStart ( Graphics g ) : void
g Graphics
Результат void
        private void DrawStart(Graphics g)
        {
            Color backColor = this.Renderer.BackColor;
            switch (this._startState)
            {
                case EMouseState.Normal:
                case EMouseState.Leave:
                    backColor = this.Renderer.BackColor;
                    break;
                case EMouseState.Move:
                case EMouseState.Up:
                    backColor = this.Renderer.EnterColor;
                    break;
                case EMouseState.Down:
                    backColor = this.Renderer.DownColor;
                    break;
            }
            using (Brush brush = new SolidBrush(backColor))
            {
                g.FillRectangle(brush, this.StartRect);
            }
            using (GraphicsPath path = new GraphicsPath())
            {
                #region 手工绘制
                //const int TEMP = 4;
                //int x = 15;
                //int y = this.StartRect.Height / 5 - 2;

                //int width = this.Width - (x * 2);
                //Point[] point = new Point[4];
                //point[0] = new Point(x, this.StartRect.Y + y + TEMP);
                //point[1] = new Point(x + width, this.StartRect.Y + y - 2);
                //point[2] = new Point(x + width, this.StartRect.Bottom - y + 2);
                //point[3] = new Point(x, this.StartRect.Bottom - y - TEMP);
                //path.AddLines(point);
                //path.CloseFigure();
                //using (Brush brush = new SolidBrush(this.Renderer.StartColor))
                //{
                //    g.FillPath(brush, path);
                //}
                //using (Pen pen = new Pen(backColor, 3.0f))
                //{
                //    int lineY = this.StartRect.Y + (this.StartRect.Height / 2);
                //    g.DrawLine(pen, x - 1, lineY, width + x + 1, lineY);
                //}
                //using (Pen pen = new Pen(backColor, 3.0f))
                //{
                //    int lineX = width / 5 * 2 + x;
                //    g.DrawLine(
                //        pen,
                //        lineX,
                //        this.StartRect.Y + y,
                //        lineX,
                //        this.StartRect.Bottom - y);
                //}
                #endregion
                int x = (this.Width - this._startSize.Width) / 2;
                int y = this.StartRect.Y + (this.StartRect.Height - this._startSize.Height) / 2;
                Rectangle rect = new Rectangle(new Point(x, y), this._startSize);
                g.DrawImage(START_IMAGE, rect, 0, 0, START_IMAGE.Width, START_IMAGE.Height, GraphicsUnit.Pixel);
            }
        }