예제 #1
0
파일: Line.cs 프로젝트: Thanak1234/test
        public void DrawLines(Point[] p, Graphics g)
        {
            SolidBrush solidBrush = new SolidBrush(this.BodyColor);
            Pen        pen        = new Pen(this.BorderColor, 1f);

            Rectangle[] rectangleArray = new Rectangle[3];
            bool[]      flagArray      = new bool[3];
            int         length         = p.Length;

            for (int index = 0; index < length - 1; ++index)
            {
                if (p[index].X == p[index + 1].X)
                {
                    int num1 = p[index].Y > p[index + 1].Y ? -2 : 2;
                    int num2 = index == 0 ? p[index].Y : p[index].Y - num1;
                    int num3 = index + 2 == length ? p[index + 1].Y - num1 : p[index + 1].Y + num1;
                    rectangleArray[index] = Rectangle.FromLTRB(p[index].X - 2, num2, p[index].X + 2, num3);
                    flagArray[index]      = true;
                    g.DrawLine(pen, p[index].X - 2, num2, p[index].X - 2, num3);
                    g.DrawLine(pen, p[index].X + 2, num2, p[index].X + 2, num3);
                }
                else
                {
                    int num1 = p[index].X > p[index + 1].X ? -2 : 2;
                    int num2 = index == 0 ? p[index].X : p[index].X - num1;
                    int num3 = index + 2 == length ? p[index + 1].X - num1 : p[index + 1].X + num1;
                    rectangleArray[index] = Rectangle.FromLTRB(num2, p[index].Y - 2, num3, p[index].Y + 2);
                    flagArray[index]      = false;
                    g.DrawLine(pen, num2, p[index].Y - 2, num3, p[index].Y - 2);
                    g.DrawLine(pen, num2, p[index].Y + 2, num3, p[index].Y + 2);
                }
            }
            for (int index = 0; index < length - 1; ++index)
            {
                rectangleArray[index] = this.Normalize(rectangleArray[index]);
                rectangleArray[index] = this.Inflate(rectangleArray[index], -1, -1, 0, 0);
                Rectangle rect = rectangleArray[index];
                rect = !flagArray[index] ? Rectangle.FromLTRB(rect.Left + 2, rect.Top, rect.Right - 2, rect.Bottom) : Rectangle.FromLTRB(rect.Left, rect.Top + 2, rect.Right, rect.Bottom - 2);
                RectShadow.DrawShade(g, rect);
            }
            for (int index = 0; index < length - 1; ++index)
            {
                g.FillRectangle((Brush)solidBrush, rectangleArray[index]);
            }
        }
예제 #2
0
        private static void DrawShadeCorner(Graphics g, Point point)
        {
            Bitmap       b    = new Bitmap(4, 4);
            GraphicsPath path = new GraphicsPath();
            Rectangle    rect = new Rectangle(0, 0, 4, 4);

            path.AddRectangle(rect);
            Graphics.FromImage((Image)b).FillPath((Brush) new PathGradientBrush(path)
            {
                CenterPoint    = (PointF) new Point(0, 0),
                CenterColor    = Color.FromArgb(128, 128, 128),
                FocusScales    = new PointF(0.1f, 0.1f),
                SurroundColors = new Color[1]
                {
                    Color.Transparent
                }
            }, path);
            RectShadow.AlphaBlend(g, b, new Rectangle(point.X, point.Y, 4, 4));
        }
예제 #3
0
        public void Draw(Graphics g)
        {
            int num = (int)Control.MouseButtons;

            Pen pen = new Pen(Color.FromArgb(128, 128, 128), 1f);

            if (m_bSelected)
            {
                DrawSelected(g);
            }
            else
            {
                DrawUnselected(g);
            }

            Rectangle titleRect = GetTitleRect();
            Rectangle rectangle = Rectangle.FromLTRB(titleRect.Left + 44, titleRect.Top + 4, titleRect.Right - 2, titleRect.Bottom);

            StringFormat format = new StringFormat();

            format.FormatFlags = format.FormatFlags | StringFormatFlags.NoWrap;
            format.Trimming    = StringTrimming.EllipsisCharacter;
            g.DrawString(m_Name, new Font("Tahoma", 8f, FontStyle.Bold), (Brush) new SolidBrush(SystemColors.WindowText), (RectangleF)rectangle, format);
            if (!m_bStart)
            {
                if (m_bMaximized)
                {
                    for (int index = 0; index < 4; ++index)
                    {
                        g.DrawLine(pen, m_Rect.Right - (12 - index), m_Rect.Top + 35 - index, m_Rect.Right - (5 + index), m_Rect.Top + 35 - index);
                    }
                }
                else
                {
                    for (int index = 0; index < 4; ++index)
                    {
                        g.DrawLine(pen, m_Rect.Right - (12 - index), m_Rect.Top + 32 + index, m_Rect.Right - (5 + index), m_Rect.Top + 32 + index);
                    }
                }
            }
            RectShadow.DrawShade(g, GetRect());
        }