public override void Draw(Graphics gr) { // While this clips the region, the lines are no longer antialiased. /* * GraphicsPath gp = new GraphicsPath(); * gp.AddPolygon(path); * Region region = new Region(gp); * gr.SetClip(region, CombineMode.Replace); * gr.IntersectClip(DisplayRectangle); * ... * gr.ResetClip(); */ // Drawing onto a bitmap that constrains the drawing area fixes the trail problem // but still has issues with larger pen widths (try 10) as triangle points are clipped. Rectangle r = DisplayRectangle.Grow(2); Bitmap bitmap = new Bitmap(r.Width, r.Height); Graphics g2 = Graphics.FromImage(bitmap); g2.SmoothingMode = SmoothingMode.AntiAlias; Point[] path = ZPath(); g2.FillPolygon(FillBrush, path); g2.DrawPolygon(BorderPen, path); gr.DrawImage(bitmap, DisplayRectangle.X, DisplayRectangle.Y); bitmap.Dispose(); g2.Dispose(); base.Draw(gr); }
public override void Draw(Graphics gr) { base.Draw(gr); Rectangle r = DisplayRectangle.Grow(-4); control.Location = r.Location; control.Size = r.Size; control.Text = Text; control.Font = TextFont; ((TextBox)control).Multiline = Multiline; }
public override void Draw(Graphics gr) { base.Draw(gr); Rectangle r = DisplayRectangle.Grow(-4); control.Location = r.Location; control.Size = r.Size; control.Text = Text; control.Enabled = Enabled; control.Visible = Visible; }
protected virtual void DrawTag(Graphics gr) { if (FillBrush.Color.ToArgb() == tagPen.Color.ToArgb()) { Rectangle r = DisplayRectangle.Grow(-2); gr.DrawRectangle(altTagPen, r); } else { Rectangle r = DisplayRectangle.Grow(-2); gr.DrawRectangle(tagPen, r); } }
public override void Draw(Graphics gr) { base.Draw(gr); Rectangle r = DisplayRectangle.Grow(-4); ((TrackBar)control).Minimum = Minimum; ((TrackBar)control).Maximum = Maximum; control.Location = r.Location; control.Size = r.Size; control.Text = Text; control.Enabled = Enabled; control.Visible = Visible; }
public override void Draw(Graphics gr) { Rectangle r = DisplayRectangle.Grow(2); Bitmap bitmap = new Bitmap(r.Width, r.Height); Graphics g2 = Graphics.FromImage(bitmap); g2.SmoothingMode = SmoothingMode.AntiAlias; Point[] path = ZPath(); g2.FillPolygon(FillBrush, path); g2.DrawPolygon(BorderPen, path); gr.DrawImage(bitmap, DisplayRectangle.X, DisplayRectangle.Y); bitmap.Dispose(); g2.Dispose(); base.Draw(gr); }