protected override bool OnExposeEvent(Gdk.EventExpose ev) { int w, h; this.GdkWindow.GetSize(out w, out h); if (fill == BoxFill.Box) { this.GdkWindow.DrawRectangle(this.Style.WhiteGC, true, 0, 0, w, h); this.GdkWindow.DrawRectangle(this.Style.BlackGC, false, 0, 0, w - 1, h - 1); } else if (fill == BoxFill.HLine) { Gdk.GC gc = new Gdk.GC(this.GdkWindow); gc.SetDashes(0, new sbyte[] { 1, 1 }, 2); gc.SetLineAttributes(SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter); gc.Foreground = this.Style.Black; this.GdkWindow.DrawLine(gc, 0, h / 2, w, h / 2); gc.Foreground = this.Style.White; this.GdkWindow.DrawLine(gc, 1, h / 2, w, h / 2); } else { Gdk.GC gc = new Gdk.GC(this.GdkWindow); gc.SetDashes(0, new sbyte[] { 1, 1 }, 2); gc.SetLineAttributes(SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter); gc.Foreground = this.Style.Black; this.GdkWindow.DrawLine(gc, w / 2, 0, w / 2, h); gc.Foreground = this.Style.White; this.GdkWindow.DrawLine(gc, w / 2, 1, w / 2, h); } return(true); }
public override void FillStrokePolygon(Color fill, Color stroke, List <Point> points, bool dashed) { Gdk.Point[] pointArray = new Gdk.Point[points.Count]; for (int i = 0; i < points.Count; ++i) { pointArray[i].X = (int)points[i].X; pointArray[i].Y = (int)points[i].Y; } Gdk.GC g = new Gdk.GC(window); g.RgbFgColor = GdkColor(fill); if (dashed) { g.SetLineAttributes(1, LineStyle.OnOffDash, CapStyle.NotLast, JoinStyle.Miter); g.SetDashes(0, new sbyte[] { 2 }, 1); } window.DrawPolygon(g, true, pointArray); g.RgbFgColor = GdkColor(stroke); window.DrawPolygon(g, false, pointArray); }
protected override bool OnExposeEvent (Gdk.EventExpose ev) { int w, h; this.GdkWindow.GetSize (out w, out h); if (fill == BoxFill.Box) { this.GdkWindow.DrawRectangle (this.Style.WhiteGC, true, 0, 0, w, h); this.GdkWindow.DrawRectangle (this.Style.BlackGC, false, 0, 0, w-1, h-1); } else if (fill == BoxFill.HLine) { using (Gdk.GC gc = new Gdk.GC (this.GdkWindow)) { gc.SetDashes (0, new sbyte [] { 1, 1 }, 2); gc.SetLineAttributes (SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter); gc.Foreground = this.Style.Black; this.GdkWindow.DrawLine (gc, 0, h / 2, w, h / 2); gc.Foreground = this.Style.White; this.GdkWindow.DrawLine (gc, 1, h/2, w, h/2); } } else { using (Gdk.GC gc = new Gdk.GC (this.GdkWindow)) { gc.SetDashes (0, new sbyte [] { 1, 1 }, 2); gc.SetLineAttributes (SelectionHandleBox.selectionLineWidth, Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter); gc.Foreground = this.Style.Black; this.GdkWindow.DrawLine (gc, w / 2, 0, w / 2, h); gc.Foreground = this.Style.White; this.GdkWindow.DrawLine (gc, w / 2, 1, w/2, h); } } return true; }