public void RunOnce(GDIRenderer aPort) { System.Drawing.Point[] points = new Point[10]; for (int i = 0; i < 10; i++) { points[i].X = fSize.Width * fFigure[i].X / 200; points[i].Y = fSize.Height * fFigure[i].Y / 100; } // Select a gray brush to draw with //aPort.SelectStockObject(GDI32.GRAY_BRUSH); GDIBrush aBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.Vertical, RGBColor.Blue, Guid.NewGuid()); aPort.SetBrush(aBrush); // First draw with ALTERNATE method aPort.SetPolyFillMode(PolygonFillMode.Alternate); aPort.Polygon(points); // Translate the x coordinates by half the screen for (int i = 0; i < 10; i++) { points[i].X += fSize.Width / 2; } // Now draw with WINDING method aPort.SetPolyFillMode(PolygonFillMode.Winding); aPort.Polygon(points); }
public static void Pack(BufferChunk chunk, GDIBrush aBrush) { chunk += GDI32.EMR_CREATEBRUSHINDIRECT; chunk += (int)aBrush.Style; chunk += (int)aBrush.Hatching; chunk += aBrush.Color; Pack(chunk, aBrush.UniqueID); }
public PLCStageBar(string name, int x, int y, int width, int height) :base(name, x, y, width, height) { fBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.Vertical, RGBColor.RGB(238, 238, 238), Guid.NewGuid()); //fPixmap = Image.FromFile("stagehead.png"); //fPixmap = new PixelBuffer(this.GetType(), "Resources.stagehead.png"); //fPixmap = new PixelBuffer(this.GetType(), "Resources.stagebar5.png"); //fPixmap = new PixelBuffer(this.GetType(), "Resources.stageheademf.emf"); }
public void RunOnce(GDIRenderer aPort) { // Do some path stuff GPath aPath = new GPath(); aPath.Begin(); aPath.MoveTo(10, 10, false); aPath.LineTo(10, 100, false); aPath.LineTo(100, 100, true); aPath.End(); GDIBrush pathBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.BDiagonal, RGBColor.Cyan, Guid.NewGuid()); aPort.FillPath(pathBrush, aPath); GDIPen pathPen = new GDIPen(PenType.Geometric, PenStyle.Solid, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Black, 10, Guid.NewGuid()); //aPort.DrawPath(pathPen, aPath); // Now use a GDIPath aPort.SetBkMode((int)BackgroundMixMode.Transparent); aPort.SetTextColor(RGBColor.Black); GDIFont aFont = new GDIFont("Impact", 96, Guid.NewGuid()); GDIContext dc = aPort.DeviceContext; GDIPath gdipath = new GDIPath(dc, Guid.NewGuid()); gdipath.Begin(); aPort.SetFont(aFont); aPort.DrawString(200, 200, "The Scaled Text"); gdipath.End(); aPort.Flush(); // First fill the text aPort.FillPath(pathBrush, gdipath); // Then stroke the path around it GDIPen textPen = new GDIPen(PenType.Geometric, PenStyle.Solid, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Black, 2, Guid.NewGuid()); aPort.DrawPath(textPen, gdipath); aPort.Flush(); }
public ClockWindow() :base("Digital Clock",10,10,320,110) { //BackgroundColor = RGBColor.LtGray; fBlackPen = new GDICosmeticPen(PenStyle.Solid, Colorrefs.Black, Guid.NewGuid()); fBackgroundBrush = new GDIBrush(BrushStyle.Solid, HatchStyle.Vertical, Colorrefs.Black, Guid.NewGuid()); fIsTracking = false; fClockDisplay = new DigitalClockDisplay(true, false); //SetWindowAlpha(128); StartTimer(1000); }
public GDIBrush OutlineBrush; //background brush #region IDisposable Members public void Dispose() { if (BackBuffer != null) { BackBuffer.Dispose(); BackBuffer = null; } if (SelectionBuffer != null) { SelectionBuffer.Dispose(); SelectionBuffer = null; } if (StringBuffer != null) { StringBuffer.Dispose(); StringBuffer = null; } if (FontNormal != null) { FontNormal.Dispose(); FontNormal = null; } if (FontBold != null) { FontBold.Dispose(); FontBold = null; } if (FontItalic != null) { FontItalic.Dispose(); FontItalic = null; } if (FontBoldItalic != null) { FontBoldItalic.Dispose(); FontBoldItalic = null; } if (FontUnderline != null) { FontUnderline.Dispose(); FontUnderline = null; } if (FontBoldUnderline != null) { FontBoldUnderline.Dispose(); FontBoldUnderline = null; } if (FontItalicUnderline != null) { FontItalicUnderline.Dispose(); FontItalicUnderline = null; } if (FontBoldItalicUnderline != null) { FontBoldItalicUnderline.Dispose(); FontBoldItalicUnderline = null; } if (GutterMarginBrush != null) { GutterMarginBrush.Dispose(); GutterMarginBrush = null; } if (GutterMarginBrush != null) { GutterMarginBrush.Dispose(); GutterMarginBrush = null; } if (LineNumberMarginBrush != null) { LineNumberMarginBrush.Dispose(); LineNumberMarginBrush = null; } if (LineNumberMarginBorderBrush != null) { LineNumberMarginBorderBrush.Dispose(); LineNumberMarginBorderBrush = null; } if (BackgroundBrush != null) { BackgroundBrush.Dispose(); BackgroundBrush = null; } if (HighLightLineBrush != null) { HighLightLineBrush.Dispose(); HighLightLineBrush = null; } if (OutlineBrush != null) { OutlineBrush.Dispose(); OutlineBrush = null; } }
//public GDIGeometryRenderer(IntPtr hDC) //{ // GDI32.SetGraphicsMode(hDC, GDI32.GM_ADVANCED); // Use advanced graphics mode so we can use world transforms // fDeviceContext = hDC; // // Create the device context specific default pen and brush // //fDCPen = new GDI32DCPen(DeviceContext, RGBColor.Black); // //fDCBrush = new GDI32DCBrush(DeviceContext, RGBColor.Black); // //BackgroundMixMode = BackgroundMixMode.TRANSPARENT; //} public virtual Brush CreateBrush(int aStyle, int hatch, uint colorref, Guid uniqueID) { GDIBrush aBrush = new GDIBrush(aStyle, hatch, colorref, uniqueID); return aBrush; }
public GDISurface StringBuffer; //backbuffer surface #endregion Fields #region Methods public void Dispose() { if (BackBuffer != null) { BackBuffer.Dispose(); BackBuffer = null; } if (SelectionBuffer != null) { SelectionBuffer.Dispose(); SelectionBuffer = null; } if (StringBuffer != null) { StringBuffer.Dispose(); StringBuffer = null; } if (FontNormal != null) { FontNormal.Dispose(); FontNormal = null; } if (FontBold != null) { FontBold.Dispose(); FontBold = null; } if (FontItalic != null) { FontItalic.Dispose(); FontItalic = null; } if (FontBoldItalic != null) { FontBoldItalic.Dispose(); FontBoldItalic = null; } if (FontUnderline != null) { FontUnderline.Dispose(); FontUnderline = null; } if (FontBoldUnderline != null) { FontBoldUnderline.Dispose(); FontBoldUnderline = null; } if (FontItalicUnderline != null) { FontItalicUnderline.Dispose(); FontItalicUnderline = null; } if (FontBoldItalicUnderline != null) { FontBoldItalicUnderline.Dispose(); FontBoldItalicUnderline = null; } if (GutterMarginBrush != null) { GutterMarginBrush.Dispose(); GutterMarginBrush = null; } if (GutterMarginBrush != null) { GutterMarginBrush.Dispose(); GutterMarginBrush = null; } if (LineNumberMarginBrush != null) { LineNumberMarginBrush.Dispose(); LineNumberMarginBrush = null; } if (LineNumberMarginBorderBrush != null) { LineNumberMarginBorderBrush.Dispose(); LineNumberMarginBorderBrush = null; } if (BackgroundBrush != null) { BackgroundBrush.Dispose(); BackgroundBrush = null; } if (HighLightLineBrush != null) { HighLightLineBrush.Dispose(); HighLightLineBrush = null; } if (OutlineBrush != null) { OutlineBrush.Dispose(); OutlineBrush = null; } }