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; } SetPenBrush(Line.ForeColor, Line.Width, Fill.FillColor); //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, P, Points.Count); ResetPenBrush(); //API.SelectObject(hDC, hOldBrush); //API.DeleteObject(hBrush); //API.SelectObject(hDC, hOldPen); //API.DeleteObject(hPen); }
public void DrawFilledRectangle(Rect theRect, ILineStyleInfo Line, IFillStyleInfo Fill) { GDILineStyle LineStyle = (GDILineStyle)Line; GDIFillStyle FillStyle = (GDIFillStyle)Fill; if (FillStyle.Mode != GuiLabs.Canvas.DrawStyle.FillMode.Solid) { GradientFillRectangle( theRect, FillStyle.FillColor, FillStyle.GradientColor, FillStyle.Mode == GuiLabs.Canvas.DrawStyle.FillMode.HorizontalGradient ? System.Drawing.Drawing2D.LinearGradientMode.Horizontal : LinearGradientMode.Vertical); DrawRectangle(theRect, Line); return; } 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.Rectangle(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); }
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); }