Ejemplo n.º 1
0
        public void FillPolygon(IList <Point> Points, ILineStyleInfo LineStyle, IFillStyleInfo FillStyle)
        {
            GDILineStyle Line = (GDILineStyle)LineStyle;
            GDIFillStyle Fill = (GDIFillStyle)FillStyle;

            API.POINT[] P = new API.POINT[Points.Count];

            for (int i = 0; i < Points.Count; i++)
            {
                P[i].x = Points[i].X;
                P[i].y = Points[i].Y;
            }

            IntPtr hPen      = API.CreatePen(0, Line.Width, Line.Win32ForeColor);
            IntPtr hOldPen   = API.SelectObject(hDC, hPen);
            IntPtr hBrush    = API.CreateSolidBrush(Fill.Win32FillColor);
            IntPtr hOldBrush = API.SelectObject(hDC, hBrush);

            API.Polygon(hDC, ref P[0], Points.Count);

            API.SelectObject(hDC, hOldBrush);
            API.DeleteObject(hBrush);
            API.SelectObject(hDC, hOldPen);
            API.DeleteObject(hPen);
        }
Ejemplo n.º 2
0
        public override void DrawLine(int x1, int y1, int x2, int y2, ILineStyleInfo theStyle)
        {
            GDILineStyle Style = (GDILineStyle)theStyle;

            IntPtr hPen    = API.CreatePen(0, theStyle.Width, Style.Win32ForeColor);
            IntPtr hOldPen = API.SelectObject(hDC, hPen);

            API.MoveToEx(hDC, x1, y1, ref NULLPOINT);
            API.LineTo(hDC, x2, y2);

            API.SelectObject(hDC, hOldPen);
            API.DeleteObject(hPen);
        }
Ejemplo n.º 3
0
        public void DrawLine(Point p1, Point p2, ILineStyleInfo theStyle)
        {
            GDILineStyle Style = (GDILineStyle)theStyle;

            IntPtr hPen    = API.CreatePen(0, theStyle.Width, Style.Win32ForeColor);
            IntPtr hOldPen = API.SelectObject(hDC, hPen);

            API.MoveToEx(hDC, p1.X, p1.Y, ref NULLPOINT);
            API.LineTo(hDC, p2.X, p2.Y);

            API.SelectObject(hDC, hOldPen);
            API.DeleteObject(hPen);
        }
Ejemplo n.º 4
0
        public void DrawFilledEllipse(Rect theRect, ILineStyleInfo Line, IFillStyleInfo Fill)
        {
            GDILineStyle LineStyle = (GDILineStyle)Line;
            GDIFillStyle FillStyle = (GDIFillStyle)Fill;

            IntPtr hPen      = API.CreatePen(0, Line.Width, LineStyle.Win32ForeColor);
            IntPtr hOldPen   = API.SelectObject(hDC, hPen);
            IntPtr hBrush    = API.CreateSolidBrush(FillStyle.Win32FillColor);
            IntPtr hOldBrush = API.SelectObject(hDC, hBrush);

            API.Ellipse(hDC, theRect.Location.X, theRect.Location.Y, theRect.Right, theRect.Bottom);

            API.SelectObject(hDC, hOldBrush);
            API.DeleteObject(hBrush);
            API.SelectObject(hDC, hOldPen);
            API.DeleteObject(hPen);
        }
Ejemplo n.º 5
0
        public void DrawEllipse(Rect theRect, ILineStyleInfo theStyle)
        {
            GDILineStyle Style = theStyle as GDILineStyle;

            if (Style == null)
            {
                Log.Instance.WriteWarning("DrawEllipse: Style == null");
                return;
            }

            IntPtr hPen    = API.CreatePen(0, theStyle.Width, Style.Win32ForeColor);
            IntPtr hOldPen = API.SelectObject(hDC, hPen);

            IntPtr hBrush    = API.GetStockObject(5);          // NULL_BRUSH
            IntPtr hOldBrush = API.SelectObject(hDC, hBrush);

            API.Ellipse(hDC, theRect.Location.X, theRect.Location.Y, theRect.Right, theRect.Bottom);

            API.SelectObject(hDC, hOldBrush);
            API.SelectObject(hDC, hOldPen);
            API.DeleteObject(hPen);
        }
Ejemplo n.º 6
0
        public void DrawRectangle(Rect theRect, ILineStyleInfo theStyle)
        {
            if (theStyle.ForeColor == System.Drawing.Color.Transparent)
            {
                return;
            }

            GDILineStyle Style = (GDILineStyle)theStyle;

            IntPtr hPen    = API.CreatePen(0, theStyle.Width, Style.Win32ForeColor);
            IntPtr hOldPen = API.SelectObject(hDC, hPen);

            IntPtr hBrush    = API.GetStockObject(5);          // NULL_BRUSH
            IntPtr hOldBrush = API.SelectObject(hDC, hBrush);

            API.Rectangle(hDC, theRect.Location.X, theRect.Location.Y, theRect.Right, theRect.Bottom);

            API.SelectObject(hDC, hOldBrush);
            API.SelectObject(hDC, hOldPen);
            API.DeleteObject(hPen);

            //			int hPen = API.CreatePen(0, theStyle.Width, theStyle.Win32ForeColor);
            //			int hOldPen = API.SelectObject(hDC, hPen);
            //
            //			int left = theRect.Location.X;
            //			int top = theRect.Location.Y;
            //			int right = theRect.Right;
            //			int bottom = theRect.Bottom;
            //
            //			API.MoveToEx(hDC, left, top, ref NULLPOINTAPI);
            //			API.LineTo(hDC, right, top);
            //			API.LineTo(hDC, right, bottom);
            //			API.LineTo(hDC, left, bottom);
            //			API.LineTo(hDC, left, top);
            //
            //			API.SelectObject(hDC, hOldPen);
            //			API.DeleteObject(hPen);
        }