public static void PaintMinusZoomButton(IGraphics g, Brush2 b, int x, int y, int bsize) { Pen2 w = new Pen2(Color2.White, 2); PaintRoundButton(g, b, w, x, y, bsize); g.DrawLine(w, x + 4, y + bsize / 2, x + bsize - 4, y + bsize / 2); }
public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush) { int s2 = size/2; Point2[] points = {new Point2(x - s2, y), new Point2(x, y - s2), new Point2(x + s2, y), new Point2(x, y + s2)}; g.FillPolygon(brush, points); g.DrawPolygon(pen, points); }
public static void PaintOverview(IGraphics g, SizeI2 totalSize, RectangleI2 visibleWin, Func <int, int, Bitmap2> getOverviewBitmap, float zoomFactorX, float zoomFactorY) { Size2 overview = CalcOverviewSize(visibleWin.Width, visibleWin.Height, totalSize.Width, totalSize.Height); Rectangle2 win = CalcWin(overview, totalSize, visibleWin, zoomFactorX, zoomFactorY); g.FillRectangle(Brushes2.White, 0, visibleWin.Height - overview.Height, overview.Width, overview.Height); g.DrawImageUnscaled(getOverviewBitmap((int)overview.Width, (int)overview.Height), 0, visibleWin.Height - overview.Height); Brush2 b = new Brush2(Color2.FromArgb(30, 0, 0, 255)); if (win.X > 0) { g.FillRectangle(b, 0, visibleWin.Height - overview.Height, win.X, overview.Height); } if (overview.Width - win.X - win.Width > 0) { g.FillRectangle(b, win.X + win.Width, visibleWin.Height - overview.Height, overview.Width - win.X - win.Width, overview.Height); } if (win.Y > 0) { g.FillRectangle(b, win.X, visibleWin.Height - overview.Height, win.Width, win.Y); } if (overview.Height - win.Y - win.Height > 0) { g.FillRectangle(b, win.X, visibleWin.Height - overview.Height + win.Y + win.Height - 1, win.Width, overview.Height - win.Y - win.Height); } g.DrawRectangle(Pens2.Black, 0, visibleWin.Height - overview.Height - 1, overview.Width, overview.Height); g.DrawRectangle(Pens2.Blue, win.X, visibleWin.Height - overview.Height - 1 + win.Y, win.Width, win.Height); }
public static void PaintZoomButtons(IGraphics g, int width, int height, ZoomButtonState state) { const int bsize = zoomButtonSize; g.SmoothingMode = SmoothingMode2.AntiAlias; Brush2 b = buttonBrush; switch (state) { case ZoomButtonState.HighlightPlus: b = buttonBrushHighlight; break; case ZoomButtonState.PressPlus: b = buttonBrushPress; break; } PaintPlusZoomButton(g, b, width - bsize - 4, height - 2 * bsize - 8, bsize); b = buttonBrush; switch (state) { case ZoomButtonState.HighlightMinus: b = buttonBrushHighlight; break; case ZoomButtonState.PressMinus: b = buttonBrushPress; break; } PaintMinusZoomButton(g, b, width - bsize - 4, height - bsize - 4, bsize); g.SmoothingMode = SmoothingMode2.Default; }
public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush) { int s2 = size/2; g.DrawLine(pen, x - s2, y, x + s2, y); g.DrawLine(pen, x, y - s2, x, y + s2); g.DrawLine(pen, x - s2, y - s2, x + s2, y + s2); g.DrawLine(pen, x + s2, y - s2, x - s2, y + s2); }
public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush) { int s2 = size/2; g.FillEllipse(brush, x - s2, y - s2, size, size); if (pen != null){ g.DrawEllipse(pen, x - s2, y - s2, size, size); } }
public static void PaintMoveRightButton(IGraphics g, Brush2 b, int x, int y, int bsize) { Pen2 w = new Pen2(Color2.White, 2); PaintRoundButton(g, b, w, x, y, bsize); g.FillClosedCurve(Brushes2.White, new[] { new Point2(x + bsize - 4, y + bsize / 2), new Point2(x + 4, y + 5), new Point2(x + 4, y + bsize - 5) }); }
public static void PaintRoundButton(IGraphics g, Brush2 b, Pen2 w, int x, int y, int size, bool selected) { if (selected) { g.FillEllipse(Brushes2.Red, x - 1, y - 1, size + 2, size + 2); } g.FillEllipse(b, x, y, size, size); g.DrawEllipse(w, x + 2, y + 2, size - 4, size - 4); }
public static void PaintMoveButtons(IGraphics g, int width, int height, MoveButtonState state) { const int bsize = zoomButtonSize; g.SmoothingMode = SmoothingMode2.AntiAlias; Brush2 b = buttonBrush; switch (state) { case MoveButtonState.HighlightUp: b = buttonBrushHighlight; break; case MoveButtonState.PressUp: b = buttonBrushPress; break; } PaintMoveUpButton(g, b, width - 3 * bsize, height - 2 * bsize - 8, bsize); b = buttonBrush; switch (state) { case MoveButtonState.HighlightLeft: b = buttonBrushHighlight; break; case MoveButtonState.PressLeft: b = buttonBrushPress; break; } PaintMoveLeftButton(g, b, (int)(width - 3.5 * bsize - 2), (int)(height - 1.5f * bsize - 6), bsize); b = buttonBrush; switch (state) { case MoveButtonState.HighlightRight: b = buttonBrushHighlight; break; case MoveButtonState.PressRight: b = buttonBrushPress; break; } PaintMoveRightButton(g, b, (int)(width - 2.5 * bsize + 2), (int)(height - 1.5f * bsize - 6), bsize); b = buttonBrush; switch (state) { case MoveButtonState.HighlightDown: b = buttonBrushHighlight; break; case MoveButtonState.PressDown: b = buttonBrushPress; break; } PaintMoveDownButton(g, b, width - 3 * bsize, height - bsize - 4, bsize); g.SmoothingMode = SmoothingMode2.Default; }
public static void PaintOverview(IGraphics g, SizeI2 totalSize, RectangleI2 visibleWin, Func <int, int, Bitmap2> getOverviewBitmap, float zoomFactorX, float zoomFactorY, bool overviewTopRight) { if (getOverviewBitmap == null) { return; } Size2 overview = CalcOverviewSize(visibleWin.Width, visibleWin.Height, totalSize.Width, totalSize.Height); Rectangle2 win = CalcWin(overview, totalSize, visibleWin, zoomFactorX, zoomFactorY); float xpos = overviewTopRight ? visibleWin.Width - overview.Width - 1 : 0; float ypos = overviewTopRight ? 1 : visibleWin.Height - overview.Height; g.FillRectangle(Brushes2.White, xpos, ypos, overview.Width, overview.Height); Bitmap2 bm = getOverviewBitmap((int)overview.Width, (int)overview.Height); if (bm == null) { return; } g.DrawImageUnscaled(bm, xpos, ypos); Brush2 b = new Brush2(Color2.FromArgb(30, 0, 0, 255)); if (win.X > 0) { g.FillRectangle(b, xpos, ypos, win.X, overview.Height); } if (overview.Width - win.X - win.Width > 0) { g.FillRectangle(b, xpos + win.X + win.Width, ypos, overview.Width - win.X - win.Width, overview.Height); } if (win.Y > 0) { g.FillRectangle(b, xpos + win.X, ypos, win.Width, win.Y); } if (overview.Height - win.Y - win.Height > 0) { g.FillRectangle(b, xpos + win.X, ypos + win.Y + win.Height - 1, win.Width, overview.Height - win.Y - win.Height); } g.DrawRectangle(Pens2.Black, xpos, ypos - 1, overview.Width, overview.Height); g.DrawRectangle(Pens2.Blue, xpos + win.X, ypos - 1 + win.Y, win.Width, win.Height); if (win.Width < 5 && win.Height < 5) { g.DrawLine(Pens2.Red, xpos + win.X, ypos + win.Y, xpos + win.X + 5, ypos + win.Y); g.DrawLine(Pens2.Red, xpos + win.X, ypos + win.Y, xpos + win.X, ypos + win.Y + 5); g.DrawLine(Pens2.Red, xpos + win.X, ypos + win.Y, xpos + win.X + 7, ypos + win.Y + 7); } }
public abstract void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush);
public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF) { DrawString(s, font, brush, rectangleF, new StringFormat2()); }
public void DrawString(string s, Font2 font, Brush2 brush, float x, float y) { StringFormat2 format = new StringFormat2{Alignment = StringAlignment2.Near, LineAlignment = StringAlignment2.Near}; DrawString(s, font, brush, new Rectangle2(new Point2(x, y), MeasureString(s, font)), format); }
internal static void DoPaint(IGraphics g, DataGridView grid) { Pen2 p = new Pen2(GraphUtils.ToColor2(grid.GridColor)); float x = grid.Location.X; float y = grid.Location.Y; Brush2 text = new Brush2(GraphUtils.ToColor2(grid.ColumnHeadersDefaultCellStyle.ForeColor)); Font2 headerFont = GraphUtils.ToFont2(grid.ColumnHeadersDefaultCellStyle.Font) ; StringFormat2 headerformat = new StringFormat2{ Alignment = StringAlignment2.Near, LineAlignment = StringAlignment2.Center }; for (int c = 0; c < grid.Columns.Count; c++){ Brush2 header = new Brush2(GraphUtils.ToColor2(grid.Columns[c].HeaderCell.Style.BackColor)); if (header.Color.IsEmpty || header.Color == Color2.Transparent || header.Color == Color2.Black || header.Color.Name == "0"){ header.Color = GraphUtils.ToColor2(grid.ColumnHeadersDefaultCellStyle.BackColor); } g.FillRectangle(header, x, y, grid.Columns[c].Width, grid.ColumnHeadersHeight); g.DrawRectangle(p, x, y, grid.Columns[c].Width, grid.ColumnHeadersHeight); g.DrawString(grid.Columns[c].HeaderText, headerFont, text, new Rectangle2(x, y, grid.Columns[c].Width, grid.ColumnHeadersHeight), headerformat); x += grid.Columns[c].Width; } y += grid.ColumnHeadersHeight; for (int r = 0; r < grid.Rows.Count; r++){ x = grid.Location.X; for (int c = 0; c < grid.Columns.Count; c++){ Color2 backcolor = GetBackColor(grid, r, c); Color2 forecolor = GetForeColor(grid, r, c); if (!backcolor.IsEmpty){ g.FillRectangle(new Brush2(backcolor), x, y, grid.Columns[c].Width, grid.Rows[r].Height); } g.DrawRectangle(p, x, y, grid.Columns[c].Width, grid.Rows[r].Height); object value = grid.Rows[r].Cells[c].Value; if (value != null){ Font2 font = GraphUtils.ToFont2(grid.DefaultCellStyle.Font) ; StringFormat2 cellformat = GetStringFormat(grid.Columns[c].DefaultCellStyle.Alignment); string t = value.ToString(); if (!string.IsNullOrEmpty(grid.Columns[c].DefaultCellStyle.Format)){ string format = "{0:" + grid.Columns[c].DefaultCellStyle.Format.ToLower() + "}"; t = string.Format(format, value); } g.DrawString(t, font, new Brush2(forecolor), new Rectangle2(x, y, grid.Columns[c].Width, grid.Rows[r].Height), cellformat); } x += grid.Columns[c].Width; } y += grid.Rows[r].Height; } }
public void DrawString(string s, Font2 font, Brush2 brush, Point2 point, StringFormat2 format) { DrawString(s, font, brush, new Rectangle2(point, MeasureString(s, font)), format); }
private void SetBrush(Brush2 b) { template.SetRGBColorFill(b.Color.R, b.Color.G, b.Color.B); }
private static void DrawString(IGraphics g, string s, Font2 font, Brush2 brush, float x, float y) { try{ g.DrawString(s, font, brush, x, y); } catch (Exception){} }
public void FillRectangle(Brush2 brush, float x, float y, float width, float height) { if ((brush).Color.IsEmpty){ return; } SetBrush(brush); template.Rectangle(x, currentHeight - y, width, -height); template.Fill(); }
public void FillRoundedRactangle(Brush2 brush, float x, float y, float width, float height, float radius) { throw new NotImplementedException(); }
public void FillPolygon(Brush2 brush, Point2[] points) { SetBrush(brush); for (int index = 0; index < points.Length; index++){ Point2 point = points[index]; if (index == 0){ template.MoveTo(point.X, currentHeight - point.Y); } else{ template.LineTo(point.X, currentHeight - point.Y); template.Stroke(); template.MoveTo(point.X, currentHeight - point.Y); } } template.Fill(); }
public void FillEllipse(Brush2 brush, float x, float y, float width, float height) { SetBrush(brush); template.Ellipse(x, currentHeight - y, x + width, currentHeight - (y + height)); template.Fill(); }
public void FillClosedCurve(Brush2 brush, Point2[] points) { FillPolygon(brush, points); }
/// <summary> /// Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height. /// </summary> /// <param name="brush">Brush that determines the characteristics of the fill.</param> /// <param name="x">The x-coordinate of the upper-left corner of the rectangle to fill.</param> /// <param name="y">The y-coordinate of the upper-left corner of the rectangle to fill.</param> /// <param name="width">Width of the rectangle to fill.</param> /// <param name="height">Height of the rectangle to fill.</param> public void FillRectangle(Brush2 brush, float x, float y, float width, float height) { rectList.Add(new Rect{X = x, Y = y, Width = width, Height = height, Fill = BrushColor(brush), Transform = Transform}); }
public static void PaintMoveUpButton(IGraphics g, Brush2 b, int x, int y, int bsize) { Pen2 w = new Pen2(Color2.White, 2); PaintRoundButton(g, b, w, x, y, bsize); g.FillClosedCurve(Brushes2.White, new[]{new Point2(x + bsize/2, y + 4), new Point2(x + 5, y + bsize - 4), new Point2(x + bsize - 5, y + bsize - 4)}); }
public void OnPaint(IGraphics g, int xm, int ym, int width, int height) { if (!Visible){ return; } if (TotalMax == double.NegativeInfinity){ return; } if ((indicator1 != -1 && indicator2 != -1) || (ZoomType == AxisZoomType.Indicate && !IsFullZoom())){ if (IsValid()){ PaintIndicator(g, width, height); } } Pen2 forePen = new Pen2(ForeColor, LineWidth); Pen2 majorTicPen = new Pen2(ForeColor, MajorTickLineWidth); Pen2 minorTicPen = new Pen2(ForeColor, MinorTickLineWidth); Brush2 brush = new Brush2(ForeColor); g.SmoothingMode = SmoothingMode2.AntiAlias; string label = Text ?? ""; float x0; float y0; int decade = 0; double[][] tics = null; double max = 0; if (IsValid()){ decade = (int) Math.Floor(Math.Log(Math.Max(Math.Abs(VisibleMax), Math.Abs(VisibleMin)))/Math.Log(10)); if (decade > 0 && decade < MaxNumIntegerDigits){ decade = 0; } if (decade != 0 && !IsLogarithmic){ label += " [1" + ToSuperscript(decade) + ']'; } tics = GetTics(GetLength(width, height)); if (tics == null){ return; } max = Math.Max(Math.Abs(ArrayUtils.Max(tics[0])), Math.Abs(ArrayUtils.Min(tics[0]))); } Font2 font = labelFont; while (g.MeasureString(label, font).Width > Math.Max(width, height)*0.95f && font.Size > 5f){ font = new Font2(font.Name, font.Size - 0.5f, font.Style); } switch (Positioning){ case AxisPositioning.Top: y0 = height - 1; g.DrawLine(forePen, xm, ym + y0, xm + width, ym + y0); if (IsValid() && tics != null){ int previousstringEnd = -Sign*int.MaxValue; for (int i = 0; i < tics[0].Length; i++){ x0 = ModelToView(tics[0][i], width, height); g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 - MajorTickLength); string s = GetTicLabel(tics[0][i], decade, max); int w = (int) g.MeasureString(s, numbersFont).Width; int pos = (int) (x0 - w/2.0); pos = Math.Max(-2, pos); pos = Math.Min(width - w + 2, pos); if (Sign*pos > Sign*previousstringEnd){ DrawString(g, s, numbersFont, brush, xm + pos + 1, ym + y0 - MajorTickLength - numbersFont.Height); previousstringEnd = pos + Sign*w; } } for (int i = 0; i < tics[1].Length; i++){ x0 = ModelToView(tics[1][i], width, height); g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 - MinorTickLength); } } DrawString(g, label, font, brush, xm + (width)/2 - (int) g.MeasureString(label, font).Width/2, ym + y0 - MajorTickLength - labelFont.Height - 12); break; case AxisPositioning.Left: x0 = width - 1; g.DrawLine(forePen, xm + x0, ym, xm + x0, ym + height); if (IsValid() && tics != null){ int previousstringEnd = -Sign*Int32.MaxValue; for (int i = 0; i < tics[0].Length; i++){ y0 = ModelToView(tics[0][i], width, height); g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0 - MajorTickLength, ym + y0); string s = GetTicLabel(tics[0][i], decade, max); int w = (int) g.MeasureString(s, numbersFont).Width; int pos = (int) (y0 + w/2.0) + 1; pos = Math.Max(w - 2, pos); pos = Math.Min(height + 2, pos); if (Sign*pos > Sign*previousstringEnd){ g.RotateTransform(-90); DrawString(g, s, numbersFont, brush, -pos - ym, xm + x0 - MajorTickLength - numbersFont.Height); g.RotateTransform(90); previousstringEnd = pos + Sign*w; } } for (int i = 0; i < tics[1].Length; i++){ y0 = ModelToView(tics[1][i], width, height); g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0 - MinorTickLength, ym + y0); } } g.RotateTransform(-90); float x = -height/2 - (int) g.MeasureString(label, font).Width/2; float y = x0 - MajorTickLength - labelFont.Height - numbersFont.Height - 10; if (y < 0){ y = 0; } DrawString(g, label, font, brush, -ym + x, xm + y - 2); g.RotateTransform(90); break; case AxisPositioning.Bottom: y0 = 0; g.DrawLine(forePen, xm, ym + y0, xm + width, ym + y0); if (IsValid() && tics != null){ int previousstringEnd = -Sign*Int32.MaxValue; for (int i = 0; i < tics[0].Length; i++){ x0 = ModelToView(tics[0][i], width, height); g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 + MajorTickLength); string s = GetTicLabel(tics[0][i], decade, max); int w = (int) g.MeasureString(s, numbersFont).Width; int pos = (int) (x0 - w/2.0); pos = Math.Max(-2, pos); pos = Math.Min(width - w + 2, pos); if (Sign*pos > Sign*previousstringEnd){ DrawString(g, s, numbersFont, brush, xm + pos + 1, ym + y0 + 1 + MajorTickLength - 1); previousstringEnd = pos + Sign*w; } } for (int i = 0; i < tics[1].Length; i++){ x0 = ModelToView(tics[1][i], width, height); g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 + MinorTickLength); } } DrawString(g, label, font, brush, xm + (width)/2 - (int) g.MeasureString(label, font).Width/2, ym + y0 + MajorTickLength + 12); break; case AxisPositioning.Right: x0 = 0; g.DrawLine(forePen, xm + x0, ym, xm + x0, ym + height); if (IsValid() && tics != null){ int previousstringEnd = -Sign*Int32.MaxValue; for (int i = 0; i < tics[0].Length; i++){ y0 = ModelToView(tics[0][i], width, height); g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0 + MajorTickLength, ym + y0); string s = GetTicLabel(tics[0][i], decade, max); int w = (int) g.MeasureString(s, numbersFont).Width; int pos = (int) (y0 - w/2.0); pos = Math.Max(-2, pos); pos = Math.Min(height - w + 2, pos); if (Sign*pos > Sign*previousstringEnd){ g.RotateTransform(90); DrawString(g, s, numbersFont, brush, ym + pos + 1, -xm - MajorTickLength - numbersFont.Height*0.99f); g.RotateTransform(-90); previousstringEnd = pos + Sign*w; } } for (int i = 0; i < tics[1].Length; i++){ y0 = ModelToView(tics[1][i], width, height); g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0 + MinorTickLength, ym + y0); } } g.RotateTransform(90); DrawString(g, label, font, brush, ym + height/2 - (int) g.MeasureString(label, font).Width/2, -xm - MajorTickLength - numbersFont.Height - labelFont.Height - 3); g.RotateTransform(-90); break; } }
/// <summary> /// /// </summary> /// <param name="brush"></param> /// <param name="points"></param> public void FillPolygon(Brush2 brush, Point2[] points) { throw new NotImplementedException(); }
private void PaintIndicator(IGraphics g, int width, int height) { Brush2 indicatorBrush = new Brush2(IndicatorColor); Pen2 indicatorPen = new Pen2(ForeColor); float len = GetDeltaIndicator(GetLength(width, height)); if (IsHorizontal()){ if (len >= 1){ g.FillRectangle(indicatorBrush, GetMinIndicator(GetLength(width, height)), 0, len, height - 1); g.DrawRectangle(indicatorPen, GetMinIndicator(GetLength(width, height)), 0, len, height - 1); } else{ g.DrawLine(indicatorPen, GetMinIndicator(GetLength(width, height)), 0, GetMinIndicator(GetLength(width, height)), height - 1); } } else{ if (len >= 1){ g.FillRectangle(indicatorBrush, 0, GetMinIndicator(GetLength(width, height)), width - 1, len); g.DrawRectangle(indicatorPen, 0, GetMinIndicator(GetLength(width, height)), width - 1, len); } else{ g.DrawLine(indicatorPen, 0, GetMinIndicator(GetLength(width, height)), width - 1, GetMinIndicator(GetLength(width, height))); } } }
public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF, StringFormat2 format) { template.BeginText(); SetFont(font); SetBrush(brush); float x = rectangleF.X; float y = rectangleF.Y - 1; Size2 size = MeasureString(s, font); if (format != null){ switch (format.Alignment){ case StringAlignment2.Center: x = x + (rectangleF.Width - size.Width)/2f; break; case StringAlignment2.Near: x = x + 2; break; case StringAlignment2.Far: x = x + (rectangleF.Width - size.Width) - 2; break; } switch (format.LineAlignment){ case StringAlignment2.Center: y = y + font.Height/2f; break; case StringAlignment2.Near: y = y + 2; break; case StringAlignment2.Far: y = y + font.Height; break; } } template.SetTextMatrix(x, currentHeight - y - (font.Height*0.5f*1.5f)); template.ShowText(s.TrimStart().TrimEnd()); template.EndText(); }
public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush) { int s2 = size/2; g.DrawRectangle(pen, x - s2, y - s2, size, size); }
/// <summary> /// Fills the interior of an ellipse defined by a bounding rectangle specified by a pair of coordinates, a width, and a height. /// </summary> /// <param name="brush">System.Drawing.Brush that determines the characteristics of the fill.</param> /// <param name="x">The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param> /// <param name="y">The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param> /// <param name="width">Width of the bounding rectangle that defines the ellipse.</param> /// <param name="height">Height of the bounding rectangle that defines the ellipse.</param> public void FillEllipse(Brush2 brush, float x, float y, float width, float height) { if (width == height){ circleList.Add(new Circle{ X = x + width/2f, Y = y + height/2f, R = width, Fill = BrushColor(brush), Transform = Transform }); } else{ ellipseList.Add(new Ellipse{ Cx = x, Cy = y, Rx = width, Ry = height, Fill = BrushColor(brush), Transform = Transform }); } }
public static void PaintOverview(IGraphics g, SizeI2 totalSize, RectangleI2 visibleWin, Func<int, int, Bitmap2> getOverviewBitmap, float zoomFactorX, float zoomFactorY) { Size2 overview = CalcOverviewSize(visibleWin.Width, visibleWin.Height, totalSize.Width, totalSize.Height); Rectangle2 win = CalcWin(overview, totalSize, visibleWin, zoomFactorX, zoomFactorY); g.FillRectangle(Brushes2.White, 0, visibleWin.Height - overview.Height, overview.Width, overview.Height); g.DrawImageUnscaled(getOverviewBitmap((int) overview.Width, (int) overview.Height), 0, visibleWin.Height - overview.Height); Brush2 b = new Brush2(Color2.FromArgb(30, 0, 0, 255)); if (win.X > 0){ g.FillRectangle(b, 0, visibleWin.Height - overview.Height, win.X, overview.Height); } if (overview.Width - win.X - win.Width > 0){ g.FillRectangle(b, win.X + win.Width, visibleWin.Height - overview.Height, overview.Width - win.X - win.Width, overview.Height); } if (win.Y > 0){ g.FillRectangle(b, win.X, visibleWin.Height - overview.Height, win.Width, win.Y); } if (overview.Height - win.Y - win.Height > 0){ g.FillRectangle(b, win.X, visibleWin.Height - overview.Height + win.Y + win.Height - 1, win.Width, overview.Height - win.Y - win.Height); } g.DrawRectangle(Pens2.Black, 0, visibleWin.Height - overview.Height - 1, overview.Width, overview.Height); g.DrawRectangle(Pens2.Blue, win.X, visibleWin.Height - overview.Height - 1 + win.Y, win.Width, win.Height); }
public void DrawString(string s, Font2 font, Brush2 brush, Point2 location) { DrawString(s, font, brush, new Rectangle2(location, new Size2(0, 0)), new StringFormat2()); }
public static void PaintRoundButton(IGraphics g, Brush2 b, Pen2 w, int x, int y, int size) { PaintRoundButton(g, b, w, x, y, size, false); }
public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF) { DrawString(s, font, brush, rectangleF, null); }
public static void PaintRoundButton(IGraphics g, Brush2 b, Pen2 w, int x, int y, int size, bool selected) { if (selected){ g.FillEllipse(Brushes2.Red, x - 1, y - 1, size + 2, size + 2); } g.FillEllipse(b, x, y, size, size); g.DrawEllipse(w, x + 2, y + 2, size - 4, size - 4); }
public static void PaintPlusZoomButton(IGraphics g, Brush2 b, int x, int y, int bsize) { Pen2 w = new Pen2(Color2.White, 2); PaintRoundButton(g, b, w, x, y, bsize); g.DrawLine(w, x + 4, y + bsize/2, x + bsize - 4, y + bsize/2); g.DrawLine(w, x + bsize - bsize/2, y + 4, x + bsize/2, y + bsize - 4); }
public string BrushColor(Brush2 b) { return GetColor(b.Color); }