public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); SizeF bsize = format.GetPixelSize(); RectangleF bounds = new RectangleF(borderpx, borderpx, bsize.Width - 2 * borderpx, bsize.Height - 2 * borderpx); r.DrawRect(secondaryColor, 1, bounds); }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); float x2 = format.GetPixelSize().Width - borderpx; for (float y = border; y < format.Height - border; y += 15) { float pt = Util.MmToPoint(y); r.DrawLine(mainColor, 1, new PointF(borderpx, pt), new PointF(x2, pt)); } }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); for (float x = border; x < format.Width - border; x += 5) { float pt = Util.MmToPoint(x); r.DrawLine(mainColor, 1, new PointF(pt, borderpx), new PointF(pt, format.GetPixelSize().Height - borderpx)); } for (float y = border; y < format.Height - border; y += 5) { float pt = Util.MmToPoint(y); r.DrawLine(mainColor, 1, new PointF(borderpx, pt), new PointF(format.GetPixelSize().Width - borderpx, pt)); } SizeF bsize = format.GetPixelSize(); RectangleF bounds = new RectangleF(borderpx, borderpx, bsize.Width - 2 * borderpx, bsize.Height - 2 * borderpx); r.DrawRect(secondaryColor, 1, bounds); }
void render(string selected) { PageFormat format = PageFormat.GetFormats()[selected]; this.Format = format; SizeF s = format.GetPixelSize(); Bitmap bmp = new Bitmap((int)s.Width, (int)s.Height); Graphics g = Graphics.FromImage(bmp); g.Clear(Color.White); SizeF sX = new SizeF(s.Width, original.Height / (float)original.Width * s.Width); SizeF sY = new SizeF(original.Width / (float)original.Height * s.Height, s.Width); SizeF sS = (sX.Width < sY.Width) ? sX : sY; g.DrawImage(original, (s.Width - sS.Width) / 2f, (s.Height - sS.Height) / 2f, sS.Width, sS.Height); EditetImage = bmp; pbPreview.Image = bmp; }
public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor) { float borderpx = Util.MmToPoint(border); float lineHeight = 32; int numLines = (int)((format.Height - 2 * border) / lineHeight); float offset = 10; float lineDist = 3; for (int i = 0; i < numLines; i++) { for (int b = 0; b < 5; b++) { float pos = border + i * lineHeight + offset + b * lineDist; float pt = Util.MmToPoint(pos); r.DrawLine(mainColor, 1, new PointF(borderpx, pt), new PointF(format.GetPixelSize().Width - borderpx, pt)); } } }