public static void DrawPoint(System.Drawing.Graphics g, PointType type, Color c, float w, float x, float y) { w = w/2; switch (type) { case PointType.TriangleUp: var triangleUp = new[] { new PointF(x - w, y + w), new PointF(x + w, y + w), new PointF(x, y - w) }; g.FillPolygon(new SolidBrush(c), triangleUp); g.DrawPolygon(new Pen(Color.Black, 1), triangleUp); break; case PointType.TriangleDown: var triangleDown = new[] { new PointF(x - w, y - w), new PointF(x + w, y - w), new PointF(x, y + w) }; g.FillPolygon(new SolidBrush(c), triangleDown); g.DrawPolygon(new Pen(Color.Black, 1), triangleDown); break; case PointType.Circle: g.FillEllipse(new SolidBrush(c), x - w, y - w, 2 * w, 2 * w); g.DrawEllipse(new Pen(Color.Black, 1), x - w, y - w, 2 * w, 2 * w); break; case PointType.Square: g.FillRectangle(new SolidBrush(c), x - w, y - w, 2 * w, 2 * w); g.DrawRectangle(new Pen(Color.Black, 1), x - w, y - w, 2 * w, 2 * w); break; default: throw new ArgumentOutOfRangeException(); } }
protected override void DrawGraph(System.Drawing.Graphics g) { using (Pen pen = new Pen(PenColor, PenWidth)) { Rectangle.Width = Math.Max(50, Rectangle.Width); Rectangle.Height = Math.Max(50, Rectangle.Height); var rect = DrawRectangle.GetNormalizedRectangle(Rectangle); PointF[] p = new PointF[4]; p[0] = new PointF(rect.Left + rect.Width / 2.0F, rect.Top); p[1] = new PointF(rect.Left, rect.Top + rect.Height / 2.0F); p[2] = new PointF(rect.Left + rect.Width / 2.0F, rect.Bottom); p[3] = new PointF(rect.Right, rect.Top + rect.Height / 2.0F); PointF[] p2 = new PointF[4]; for (int i = 0; i < 4; i++) { p2[i] = new PointF(p[i].X + 3, p[i].Y + 3); } g.FillPolygon(Brushes.LightGray, p2); using (var brush = DrawRectangle.GetBackgroundBrush(rect, this.BackColor)) { g.FillPolygon(brush, p); } g.DrawPolygon(pen, p); } }
public void Draw(System.Drawing.Graphics graphics, System.Drawing.Rectangle destRect, System.Drawing.Rectangle sourceRect) { if (IsOpened) { using (Brush b= new SolidBrush(Color.Red)) { graphics.FillPolygon(b, new Point[]{ new Point(destRect.Left + (destRect.Width/2)+ClientSettings.Margin, destRect.Bottom-(ClientSettings.Margin*4)), new Point(destRect.Left + (destRect.Width/2), destRect.Bottom), new Point(destRect.Left + (destRect.Width/2)-ClientSettings.Margin, destRect.Bottom-(ClientSettings.Margin*4)), }); using (Image userbmp = ThrottledArtGrabber.GetArt(this.userToDraw.profile_image_url)) { graphics.DrawImage(userbmp, destRect.X, destRect.Y); } } } else { TiledMaps.IGraphicsDrawable graphicsDrawable = ThrottledArtGrabber.mapMarkerImage as TiledMaps.IGraphicsDrawable; graphicsDrawable.Draw(graphics, destRect, sourceRect); Rectangle CharRect = new Rectangle(destRect.X + 7, destRect.Y+2, destRect.Width - 6, destRect.Height-2); if (charToUse >= 0) { using (Font f = new Font(FontFamily.GenericSansSerif, fSize, FontStyle.Regular)) { graphics.DrawString(charToUse.ToString(), f, B, CharRect); } } } Location = destRect; }
public override void Draw(System.Drawing.Graphics g) { System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(Color); System.Drawing.PointF[] points = new System.Drawing.PointF[3]; points[0] = new System.Drawing.PointF((float)Vertex1.X, (float)Vertex1.Y); points[1] = new System.Drawing.PointF((float)Vertex2.X, (float)Vertex2.Y); points[2] = new System.Drawing.PointF((float)Vertex3.X, (float)Vertex3.Y); g.FillPolygon(solidBrush, points); solidBrush.Dispose(); }
public void renk_fill(System.Drawing.Graphics grap, System.Drawing.Point p, ulke ulkelabel, Label label, Panel panel, Label labell,Label secilen_ulke, List<ulke> ulkeler, Button buton1, int adet) { if (ulkelabel.sahip == null) { riskcsharp.ulke c = Games.haritaolustur.getCityAtPoint(p); if (c == null) return; mybrush = new SolidBrush(Durum.sırakimde.renkoku()); grap.FillPolygon(mybrush, c.ulke_Koordinat); kalan_bonus(labell); toprak_Ekle(Durum.sırakimde, 1); asker_Ver(Durum.sırakimde, 1); asker_dagit(adet, ulkelabel); oyuncu_Degistir(profil.oyuncular); ortam_Controldegistir(Durum.sırakimde, label,secilen_ulke, panel); } int i = 0; foreach (ulke k in ulkeler) { if (k.sahip != null) { i++; } } if (i == ulkeler.Count) { buton1.Enabled = true; } else { buton1.Enabled = false; } }
private void ShowSpecialChar(System.Drawing.Graphics CurGraphics, System.Char CurChar, System.Int32 Y, System.Int32 X, System.Drawing.Color CurFGColor, System.Drawing.Color CurBGColor) { if (CurChar == '\0') { return; } switch (CurChar) { case '`': // diamond System.Drawing.Point[] CurPoints = new System.Drawing.Point[4]; CurPoints[0] = new System.Drawing.Point (X + this.CharSize.Width/2, Y + this.CharSize.Height/6); CurPoints[1] = new System.Drawing.Point (X + 5*this.CharSize.Width/6, Y + this.CharSize.Height/2); CurPoints[2] = new System.Drawing.Point (X + this.CharSize.Width/2, Y + 5*this.CharSize.Height/6); CurPoints[3] = new System.Drawing.Point (X + this.CharSize.Width/6, Y + this.CharSize.Height/2); CurGraphics.FillPolygon ( new System.Drawing.SolidBrush (CurFGColor), CurPoints); break; case 'l': // top left bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2 -1, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 'q': // horizontal line CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); break; case 'w': // top tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 'k': // top right bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 'x': // vertical line CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 't': // left hand tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); break; case 'n': // cross piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); break; case 'u': // right hand tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 'm': // bottom left bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); break; case 'v': // bottom tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); break; case 'j': // bottom right bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); break; default: break; } }
public void Draw(System.Drawing.Graphics g, System.Drawing.RectangleF innerArea) { innerArea.Inflate(_shadowLength / 2, _shadowLength / 2); // Padding RectangleF outerArea = innerArea; outerArea.Inflate(_shadowLength, _shadowLength); _brush.Rectangle = outerArea; g.FillRectangle(_brush, outerArea); SolidBrush twhite = new SolidBrush(Color.FromArgb(128, 255, 255, 255)); g.FillPolygon(twhite, new PointF[] { new PointF(outerArea.Left,outerArea.Top), // upper left point new PointF(outerArea.Right,outerArea.Top), // go to the right new PointF(innerArea.Right,innerArea.Top), // go 45 deg left down in the upper right corner new PointF(innerArea.Left,innerArea.Top), // upper left corner of the inner rectangle new PointF(innerArea.Left,innerArea.Bottom), // lower left corner of the inner rectangle new PointF(outerArea.Left,outerArea.Bottom) // lower left corner }); SolidBrush tblack = new SolidBrush(Color.FromArgb(128, 0, 0, 0)); g.FillPolygon(tblack, new PointF[] { new PointF(outerArea.Right,outerArea.Bottom), new PointF(outerArea.Right,outerArea.Top), new PointF(innerArea.Right,innerArea.Top), new PointF(innerArea.Right,innerArea.Bottom), // upper left corner of the inner rectangle new PointF(innerArea.Left,innerArea.Bottom), // lower left corner of the inner rectangle new PointF(outerArea.Left,outerArea.Bottom) // lower left corner }); }
public void Render(System.Drawing.Graphics g, WorldTransform t) { // show intersection safetyzone if supposed to show safety zone (polygon red hatch) if (DrawingUtility.DrawArbiterSafetyZones) { // show intersection polygon HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterSafetyZone, Color.White); // populate polygon List<PointF> polyPoints = new List<PointF>(); foreach (Coordinates c in this.IntersectionPolygon.points) { polyPoints.Add(DrawingUtility.ToPointF(c)); } // draw poly and fill g.FillPolygon(hBrush1, polyPoints.ToArray()); } // render stopped exits foreach (ArbiterStoppedExit ase in this.StoppedExits) { ase.Render(g, t); } // draw intersection polygon DrawingUtility.DrawControlPolygon(this.IntersectionPolygon, DrawingUtility.ColorArbiterIntersection, DashStyle.DashDotDot, g, t); // show incoming lane points (disjoint from exits) foreach (KeyValuePair<ArbiterLane, LinePath.PointOnPath> pop in this.IncomingLanePoints) { DrawingUtility.DrawControlPoint(pop.Key.LanePath().GetPoint(pop.Value), DrawingUtility.ColorArbiterIntersectionIncomingLanePoints, null, ContentAlignment.MiddleCenter, ControlPointStyle.SmallX, g, t); } // show all entries foreach (ITraversableWaypoint aw in this.AllEntries.Values) { DrawingUtility.DrawControlPoint(aw.Position, DrawingUtility.ColorArbiterIntersectionEntries, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeCircle, g, t); } // show all exits foreach (ITraversableWaypoint aw in this.AllExits.Values) { DrawingUtility.DrawControlPoint(aw.Position, DrawingUtility.ColorArbiterIntersectionExits, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeCircle, g, t); } // draw center point DrawingUtility.DrawControlPoint(this.Center, DrawingUtility.ColorArbiterIntersection, null, ContentAlignment.MiddleCenter, ControlPointStyle.LargeX, g, t); }
/// <summary> /// Draw the filled region /// </summary> /// <param name="g">The GDI+ surface on which to draw.</param> /// <param name="xAxis">The X-Axis to draw against.</param> /// <param name="yAxis">The Y-Axis to draw against.</param> public void Draw( System.Drawing.Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis ) { ITransform2D t = Transform2D.GetTransformer(xAxis, yAxis); Brush b = brush_; if (b == null) { b = areaBrush_.Get(new Rectangle(xAxis.PhysicalMin.X, yAxis.PhysicalMax.Y, xAxis.PhysicalLength, yAxis.PhysicalLength)); } if (hl1_ != null && hl2_ != null) { PointF[] points = new PointF[4]; points[0] = t.Transform(xAxis.Axis.WorldMin, hl1_.OrdinateValue); points[1] = t.Transform(xAxis.Axis.WorldMax, hl1_.OrdinateValue); points[2] = t.Transform(xAxis.Axis.WorldMax, hl2_.OrdinateValue); points[3] = t.Transform(xAxis.Axis.WorldMin, hl2_.OrdinateValue); g.FillPolygon(b, points); } else if (vl1_ != null && vl2_ != null) { PointF[] points = new PointF[4]; points[0] = t.Transform(vl1_.AbscissaValue, yAxis.Axis.WorldMin); points[1] = t.Transform(vl1_.AbscissaValue, yAxis.Axis.WorldMax); points[2] = t.Transform(vl2_.AbscissaValue, yAxis.Axis.WorldMax); points[3] = t.Transform(vl2_.AbscissaValue, yAxis.Axis.WorldMin); g.FillPolygon(b, points); } else if (lp1_ != null && lp2_ != null) { SequenceAdapter a1 = new SequenceAdapter(lp1_.DataSource, lp1_.DataMember, lp1_.OrdinateData, lp1_.AbscissaData); SequenceAdapter a2 = new SequenceAdapter(lp2_.DataSource, lp2_.DataMember, lp2_.OrdinateData, lp2_.AbscissaData); int count = a1.Count + a2.Count; PointF[] points = new PointF[count]; for (int i = 0; i < a1.Count; ++i) { points[i] = t.Transform(a1[i]); } for (int i = 0; i < a2.Count; ++i) { points[i + a1.Count] = t.Transform(a2[a2.Count - i - 1]); } g.FillPolygon(b, points); } else { throw new NPlotException("One of bounds was set to null"); } }
public void Draw(System.Drawing.Graphics g) { Pen pen = new Pen(DrawSettings.Color, DrawSettings.Thickness); g.SmoothingMode = SmoothingMode.AntiAlias; Rectangle rect = PaintHelper.NormalizeRect(startPoint, endPoint); Point p1 = new Point(rect.X, rect.Y + rect.Height); Point p2 = new Point(rect.X + rect.Width / 2, rect.Y); Point p3 = new Point(rect.X + rect.Width, rect.Y + rect.Height); g.DrawLine(pen, p1, p2); g.DrawLine(pen, p2, p3); g.DrawLine(pen, p3, p1); if (DrawSettings.BackColor != System.Drawing.Color.Transparent) { SolidBrush brush = new SolidBrush(DrawSettings.BackColor); g.FillPolygon(brush, new Point[]{p1,p2,p3}, FillMode.Alternate); brush.Dispose(); } pen.Dispose(); }
public void ShowSpecialChar( System.Drawing.Graphics CurGraphics, System.Char CurChar, System.Int32 Y, System.Int32 X, System.Drawing.Color CurFGColor, System.Drawing.Color CurBGColor) { //prntSome.printSome("ShowSpecialChar"); if (CurChar == '\0') { return; } switch (CurChar) { case '`': // diamond System.Drawing.Point[] CurPoints = new System.Drawing.Point[4]; CurPoints[0] = new System.Drawing.Point (X + this.CharSize.Width/2, Y + this.CharSize.Height/6); CurPoints[1] = new System.Drawing.Point (X + 5*this.CharSize.Width/6, Y + this.CharSize.Height/2); CurPoints[2] = new System.Drawing.Point (X + this.CharSize.Width/2, Y + 5*this.CharSize.Height/6); CurPoints[3] = new System.Drawing.Point (X + this.CharSize.Width/6, Y + this.CharSize.Height/2); CurGraphics.FillPolygon ( new System.Drawing.SolidBrush (CurFGColor), CurPoints); break; case 'l': case 'Z': // top left bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2 -1, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 'q': case 'D': // horizontal line CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); break; case 'B': // top tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case '?': // top right bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case '3': // vertical line CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case 'C': // left hand tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); break; case 'E': // cross piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); break; case '4': // right hand tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height); break; case '@': // bottom left bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); break; case 'A': // bottom tee-piece CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); break; case 'Y': // bottom right bracket CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X, Y + this.CharSize.Height/2, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); CurGraphics.DrawLine (new System.Drawing.Pen (CurFGColor, 1), X + this.CharSize.Width/2, Y, X + this.CharSize.Width/2, Y + this.CharSize.Height/2); break; default: break; } }
/// <summary> /// Draws link's terminal ponit. /// </summary> /// <param name="canvas"></param> /// <param name="style"></param> /// <param name="pt1"></param> /// <param name="pt2"></param> private void DrawTerminal(System.Drawing.Graphics canvas, GOM_Terminal_Style style, System.Drawing.PointF pt1, System.Drawing.PointF pt2) { System.Drawing.Drawing2D.Matrix matrix; float angle; angle = (float)(System.Math.Atan2(pt2.Y - pt1.Y, pt2.X - pt1.X) / System.Math.PI) * 180; matrix = canvas.Transform; canvas.TranslateTransform(pt1.X, pt1.Y); canvas.RotateTransform(angle); switch (style) { case GOM_Terminal_Style.Circle: { canvas.FillEllipse(new System.Drawing.SolidBrush(m_drawingStyle.drawingStyle.Color), -5, -5, 10, 10); break; } case GOM_Terminal_Style.Arrow: { canvas.DrawLine(m_drawingStyle.drawingStyle, 0, 0, 10, 5); canvas.DrawLine(m_drawingStyle.drawingStyle, 0, 0, 10, -5); break; } case GOM_Terminal_Style.Triangle: { System.Drawing.Point[] rgPts; rgPts = new System.Drawing.Point[3]; rgPts[0].X = 0; rgPts[0].Y = 0; rgPts[1].X = 10; rgPts[1].Y = 5; rgPts[2].X = 10; rgPts[2].Y = -5; canvas.FillPolygon(new System.Drawing.SolidBrush(m_drawingStyle.drawingStyle.Color), rgPts); break; } case GOM_Terminal_Style.Diamond: { System.Drawing.Point[] rgPts; rgPts = new System.Drawing.Point[4]; rgPts[0].X = 0; rgPts[0].Y = 0; rgPts[1].X = 5; rgPts[1].Y = 5; rgPts[2].X = 10; rgPts[2].Y = 0; rgPts[3].X = 5; rgPts[3].Y = -5; canvas.FillPolygon(new System.Drawing.SolidBrush(m_drawingStyle.drawingStyle.Color), rgPts); break; } } canvas.Transform = matrix; }
void OnPostPaint(System.Drawing.Graphics g) { try { switch(this.tool) { case WhiteboardToolCode.Line: { if(g!=null) { lock(g) { g.DrawLine((new Pen(color,this.lineThickness)),this.mouseDownPos,this.mouseCurrentPos); } } break; } case WhiteboardToolCode.Rectangle: { int left=Math.Min(this.mouseDownPos.X,this.mouseCurrentPos.X); int top=Math.Min(this.mouseDownPos.Y,this.mouseCurrentPos.Y); int width=Math.Max(this.mouseDownPos.X,this.mouseCurrentPos.X) - left; int height=Math.Max(this.mouseDownPos.Y,this.mouseCurrentPos.Y) - top; if(g!=null) { lock(g) { g.DrawRectangle((new Pen(color, this.lineThickness)),left,top,width,height); } } break; } case WhiteboardToolCode.Ellipse: { int left=Math.Min(this.mouseDownPos.X,this.mouseCurrentPos.X); int top=Math.Min(this.mouseDownPos.Y,this.mouseCurrentPos.Y); int width=Math.Max(this.mouseDownPos.X,this.mouseCurrentPos.X) - left; int height=Math.Max(this.mouseDownPos.Y,this.mouseCurrentPos.Y) - top; if(g!=null) { lock(g) { g.DrawEllipse((new Pen(color,this.lineThickness)),left,top,width,height); } } break; } case WhiteboardToolCode.UniArrow: { Point pFrom = this.mouseDownPos; Point pBase = new Point(0,0); Point[] aptPoly=new Point[3]; float[] vecLine = new float[2]; float[] vecLeft= new float[2];; float fLength; float th; float ta; // get from point // set to point aptPoly[0].X = this.mouseCurrentPos.X; aptPoly[0].Y = this.mouseCurrentPos.Y; // build the line vector vecLine[0] = (float) aptPoly[0].X - pFrom.X; vecLine[1] = (float) aptPoly[0].Y - pFrom.Y; // build the arrow base vector - normal to the line vecLeft[0] = -vecLine[1]; vecLeft[1] = vecLine[0]; // setup length parameters fLength = (float) Math.Sqrt(vecLine[0] * vecLine[0] + vecLine[1] * vecLine[1]); th = pA.nWidth / (2.0f * fLength); ta = pA.nWidth / (2.0f * ((float)Math.Tan(pA.fTheta) / 2.0f) * fLength); // find the base of the arrow pBase.X = (int) (aptPoly[0].X + -ta * vecLine[0]); pBase.Y = (int) (aptPoly[0].Y + -ta * vecLine[1]); // build the points on the sides of the arrow aptPoly[1].X = (int) (pBase.X + th * vecLeft[0]); aptPoly[1].Y = (int) (pBase.Y + th * vecLeft[1]); aptPoly[2].X = (int) (pBase.X + -th * vecLeft[0]); aptPoly[2].Y = (int) (pBase.Y + -th * vecLeft[1]); Point p6 = new Point(pBase.X, pBase.Y); Point p7= new Point(aptPoly[1].X, aptPoly[1].Y); Point p3= new Point (aptPoly[0].X, aptPoly[0].Y); Point p4= new Point(aptPoly[2].X, aptPoly[2].Y); Point p5= new Point(pBase.X, pBase.Y); if(g!=null) { lock(g) { g.FillPolygon((new Pen(this.color,this.lineThickness)).Brush,new Point[]{p6,p7,p3,p4,p5}); g.DrawLine((new Pen(this.color)),this.mouseDownPos,this.mouseCurrentPos); } } break; } } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing void OnPostPaint(System.Drawing.Graphics g)",ex,"",false); } }
public override void Render(System.Drawing.Graphics graphics) { graphics.FillPolygon(this.Brush, this.Bounds); }
public void Render(System.Drawing.Graphics g, WorldTransform t) { // show stopped exits (blue diags) HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterIntersectionStoppedExit, Color.White); // populate polygon List<PointF> polyPoints = new List<PointF>(); foreach (Coordinates c in this.ExitPolygon.points) { polyPoints.Add(DrawingUtility.ToPointF(c)); } // draw poly and fill g.FillPolygon(hBrush1, polyPoints.ToArray()); }
/// <summary> /// Renders the lane splint /// </summary> /// <param name="g"></param> /// <param name="t"></param> /// <remarks>TODO: set lane spline</remarks> public void Render(System.Drawing.Graphics g, WorldTransform t) { Color c = DrawingUtility.ColorArbiterLaneSpline; if (DrawingUtility.DisplayArbiterLanes) { Coordinates cp = t.GetWorldPoint(new PointF(t.ScreenSize.Width/2, t.ScreenSize.Height/2)); Coordinates lp = this.LanePath().GetClosestPoint(cp).Location; string s = this.LaneId.ToString(); DrawingUtility.DrawControlLabel(lp, Color.DarkBlue, s, ContentAlignment.MiddleCenter, ControlPointStyle.None, g, t); } bool displayPolygon = false; switch (this.LaneId.Number) { case 1: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon1; break; case 2: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon2; break; case 3: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon3; break; case 4: displayPolygon = DrawingUtility.DisplayArbiterLanePolygon4; break; } if (displayPolygon && this.LanePolygon != null) { // show intersection polygon HatchBrush hBrush1 = new HatchBrush(HatchStyle.ForwardDiagonal, DrawingUtility.ColorArbiterLanePolygon, Color.White); // populate polygon List<PointF> polyPoints = new List<PointF>(); foreach (Coordinates lpp in this.LanePolygon.points) { polyPoints.Add(DrawingUtility.ToPointF(lpp)); } // draw poly and fill g.FillPolygon(hBrush1, polyPoints.ToArray()); DrawingUtility.DrawControlPolygon(this.LanePolygon, DrawingUtility.ColorArbiterLanePolygon, System.Drawing.Drawing2D.DashStyle.Solid, g, t); } if(DrawingUtility.DisplayArbiterLanePath) { DrawingUtility.DrawControlLine(this.laneLinePath, g, t, new Pen(Color.MediumVioletRed), Color.MediumVioletRed); } }
/// <summary> /// Renders a polygon to the map. /// </summary> /// <param name="g">Graphics reference</param> /// <param name="pol">Polygon to render</param> /// <param name="brush">Brush used for filling (null or transparent for no filling)</param> /// <param name="pen">Outline pen style (null if no outline)</param> /// <param name="clip">Specifies whether polygon clipping should be applied</param> /// <param name="map">Map reference</param> public static void DrawPolygon(System.Drawing.Graphics g, IPolygon pol, System.Drawing.Brush brush, System.Drawing.Pen pen, bool clip, IMap map) { try { if (pol.Shell == null) return; if (pol.Shell.Coordinates.Length > 2) { var points = Transform.TransformToImage(pol.Shell, map, SimplifyGeometryDuringRendering); var solidBrush = brush as SolidBrush; if (solidBrush != null && solidBrush.Color.A != 0) { g.FillPolygon(brush, points, FillMode.Alternate); } if (pen != null) { g.DrawPolygon(pen, points); } for (int i = 0; i < pol.Holes.Length; i++) { points = Transform.TransformToImage(pol.Holes[i], map, SimplifyGeometryDuringRendering); if (solidBrush != null && solidBrush.Color.A != 0) { g.FillPolygon(brush, points); } if (pen != null) { g.DrawPolygon(pen, points); } } } } catch(InvalidOperationException e) { log.WarnFormat("Error during rendering", e); } catch (OverflowException e) { log.WarnFormat("Error during rendering", e); } }
/// <summary> /// Fill a polygon on the canvas /// </summary> /// <param name="canvas">The canvas on which a polygon is filled</param> public void Fill(System.Drawing.Graphics canvas) { System.Drawing.Point[] rgPoints; rgPoints = new System.Drawing.Point[m_points.Count]; for (int i = 0; i < m_points.Count; i++) { rgPoints[i].X = (int)m_points[i].x; rgPoints[i].Y = (int)m_points[i].y; } canvas.FillPolygon(m_style.fillingStyle, rgPoints); }
internal static void RenderArrowInternal( System.Drawing.Graphics g, Rectangle dropDownRect, ArrowDirection direction, Brush brush) { Point point = new Point( dropDownRect.Left + (dropDownRect.Width / 2), dropDownRect.Top + (dropDownRect.Height / 2)); Point[] points = null; switch (direction) { case ArrowDirection.Left: points = new Point[] { new Point(point.X + 1, point.Y - 4), new Point(point.X + 1, point.Y + 4), new Point(point.X - 2, point.Y) }; break; case ArrowDirection.Up: points = new Point[] { new Point(point.X - 4, point.Y + 1), new Point(point.X + 4, point.Y + 1), new Point(point.X, point.Y - 2) }; break; case ArrowDirection.Right: points = new Point[] { new Point(point.X - 2, point.Y - 4), new Point(point.X - 2, point.Y + 4), new Point(point.X + 1, point.Y) }; break; default: points = new Point[] { new Point(point.X - 4, point.Y - 1), new Point(point.X + 4, point.Y - 1), new Point(point.X, point.Y + 2) }; break; } g.FillPolygon(brush, points); }
/// <summary> /// Draws the arrow on a plot surface. /// </summary> /// <param name="g">graphics surface on which to draw</param> /// <param name="xAxis">The X-Axis to draw against.</param> /// <param name="yAxis">The Y-Axis to draw against.</param> public void Draw( System.Drawing.Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis ) { if (this.To.X > xAxis.Axis.WorldMax || this.To.X < xAxis.Axis.WorldMin) return; if (this.To.Y > yAxis.Axis.WorldMax || this.To.Y < yAxis.Axis.WorldMin) return; double angle = this.angle_; if (this.angle_ < 0.0) { int mul = -(int)(this.angle_ / 360.0) + 2; angle = angle_ + 360.0 * (double)mul; } double normAngle = (double)angle % 360.0; // angle in range 0 -> 360. Point toPoint = new Point( (int)xAxis.WorldToPhysical( to_.X, true ).X, (int)yAxis.WorldToPhysical( to_.Y, true ).Y ); float xDir = (float)Math.Cos( normAngle * 2.0 * Math.PI / 360.0 ); float yDir = (float)Math.Sin( normAngle * 2.0 * Math.PI / 360.0 ); toPoint.X += (int)(xDir*headOffset_); toPoint.Y += (int)(yDir*headOffset_); float xOff = physicalLength_ * xDir; float yOff = physicalLength_ * yDir; Point fromPoint = new Point( (int)(toPoint.X + xOff), (int)(toPoint.Y + yOff) ); g.DrawLine( pen_, toPoint, fromPoint ); Point[] head = new Point[3]; head[0] = toPoint; xOff = headSize_ * (float)Math.Cos( (normAngle-headAngle_/2.0f) * 2.0 * Math.PI / 360.0 ); yOff = headSize_ * (float)Math.Sin( (normAngle-headAngle_/2.0f) * 2.0 * Math.PI / 360.0 ); head[1] = new Point( (int)(toPoint.X + xOff), (int)(toPoint.Y + yOff) ); float xOff2 = headSize_ * (float)Math.Cos( (normAngle+headAngle_/2.0f) * 2.0 * Math.PI / 360.0 ); float yOff2 = headSize_ * (float)Math.Sin( (normAngle+headAngle_/2.0f) * 2.0 * Math.PI / 360.0 ); head[2] = new Point( (int)(toPoint.X + xOff2), (int)(toPoint.Y + yOff2) ); g.FillPolygon( arrowBrush_, head ); SizeF textSize = g.MeasureString( text_, font_ ); SizeF halfSize = new SizeF( textSize.Width / 2.0f, textSize.Height / 2.0f ); float quadrantSlideLength = halfSize.Width + halfSize.Height; float quadrantF = (float)normAngle / 90.0f; // integer part gives quadrant. int quadrant = (int)quadrantF; // quadrant in. float prop = quadrantF - (float)quadrant; // proportion of way through this qadrant. float dist = prop * quadrantSlideLength; // distance along quarter of bounds rectangle. // now find the offset from the middle of the text box that the // rear end of the arrow should end at (reverse this to get position // of text box with respect to rear end of arrow). // // There is almost certainly an elgant way of doing this involving // trig functions to get all the signs right, but I'm about ready to // drop off to sleep at the moment, so this blatent method will have // to do. PointF offsetFromMiddle = new PointF( 0.0f, 0.0f ); switch (quadrant) { case 0: if (dist > halfSize.Height) { dist -= halfSize.Height; offsetFromMiddle = new PointF( -halfSize.Width + dist, halfSize.Height ); } else { offsetFromMiddle = new PointF( -halfSize.Width, - dist ); } break; case 1: if (dist > halfSize.Width) { dist -= halfSize.Width; offsetFromMiddle = new PointF( halfSize.Width, halfSize.Height - dist ); } else { offsetFromMiddle = new PointF( dist, halfSize.Height ); } break; case 2: if (dist > halfSize.Height) { dist -= halfSize.Height; offsetFromMiddle = new PointF( halfSize.Width - dist, -halfSize.Height ); } else { offsetFromMiddle = new PointF( halfSize.Width, -dist ); } break; case 3: if (dist > halfSize.Width) { dist -= halfSize.Width; offsetFromMiddle = new PointF( -halfSize.Width, -halfSize.Height + dist ); } else { offsetFromMiddle = new PointF( -dist, -halfSize.Height ); } break; default: throw new NPlotException( "Programmer error." ); } g.DrawString( text_, font_, textBrush_, (int)(fromPoint.X - halfSize.Width - offsetFromMiddle.X), (int)(fromPoint.Y - halfSize.Height + offsetFromMiddle.Y) ); }
/// <summary> /// 绘制子页面 /// </summary> /// <param name="g">绘图画面</param> /// <param name="tabPage">tab页面</param> /// <param name="nIndex">页面索引</param> /// <param name="bHovered">是否hover状态 如果不是选中,就是hover状态</param> public virtual void DrawTab(System.Drawing.Graphics g, System.Windows.Forms.TabPage tabPage, int nIndex, bool bHovered) { Rectangle recBounds = _owner.GetTabRect(nIndex); RectangleF tabTextArea = (RectangleF)_owner.GetTabRect(nIndex); bool bSelected = (_owner.SelectedIndex == nIndex); if (bSelected) { Point[] pt = new Point[7]; switch (_owner.Alignment) { case TabAlignment.Top: { pt[0] = new Point(recBounds.Left, recBounds.Bottom); pt[1] = new Point(recBounds.Left, recBounds.Top + 3); pt[2] = new Point(recBounds.Left + 3, recBounds.Top); pt[3] = new Point(recBounds.Right - 3, recBounds.Top); pt[4] = new Point(recBounds.Right, recBounds.Top + 3); pt[5] = new Point(recBounds.Right, recBounds.Bottom); pt[6] = new Point(recBounds.Left, recBounds.Bottom); } break; case TabAlignment.Bottom: { pt[0] = new Point(recBounds.Left, recBounds.Top); pt[1] = new Point(recBounds.Right, recBounds.Top); pt[2] = new Point(recBounds.Right, recBounds.Bottom - 3); pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom); pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom); pt[5] = new Point(recBounds.Left, recBounds.Bottom - 3); pt[6] = new Point(recBounds.Left, recBounds.Top); } break; case TabAlignment.Left: { pt[0] = new Point(recBounds.Right, recBounds.Top); pt[1] = new Point(recBounds.Right, recBounds.Bottom); pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom); pt[3] = new Point(recBounds.Left, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Left, recBounds.Top + 3); pt[5] = new Point(recBounds.Left + 3, recBounds.Top); pt[6] = new Point(recBounds.Right, recBounds.Top); } break; case TabAlignment.Right: { pt[0] = new Point(recBounds.Left, recBounds.Top); pt[1] = new Point(recBounds.Right - 3, recBounds.Top); pt[2] = new Point(recBounds.Right, recBounds.Top + 3); pt[3] = new Point(recBounds.Right, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom); pt[5] = new Point(recBounds.Left, recBounds.Bottom); pt[6] = new Point(recBounds.Left, recBounds.Top); } break; } // fill this tab with background color Brush br = new SolidBrush(tabPage.BackColor); //Brush br = new SolidBrush(Color.White); g.FillPolygon(br, pt); br.Dispose(); // draw border using (Pen pen1 = new Pen(Color.FromArgb(19, 28, 37))) { g.DrawPolygon(pen1, pt); } #region 内边框 switch (_owner.Alignment) { case TabAlignment.Top: { pt[0] = new Point(recBounds.Left + 1, recBounds.Bottom); pt[1] = new Point(recBounds.Left + 1, recBounds.Top + 3); pt[2] = new Point(recBounds.Left + 3, recBounds.Top + 1); pt[3] = new Point(recBounds.Right - 3, recBounds.Top + 1); pt[4] = new Point(recBounds.Right - 1, recBounds.Top + 3); pt[5] = new Point(recBounds.Right - 1, recBounds.Bottom); pt[6] = new Point(recBounds.Left + 1, recBounds.Bottom); } break; case TabAlignment.Bottom: { pt[0] = new Point(recBounds.Left + 1, recBounds.Top); pt[1] = new Point(recBounds.Right - 1, recBounds.Top); pt[2] = new Point(recBounds.Right - 1, recBounds.Bottom - 3); pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom - 1); pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom - 1); pt[5] = new Point(recBounds.Left + 1, recBounds.Bottom - 3); pt[6] = new Point(recBounds.Left + 1, recBounds.Top); } break; case TabAlignment.Left: { pt[0] = new Point(recBounds.Right, recBounds.Top + 1); pt[1] = new Point(recBounds.Right, recBounds.Bottom - 1); pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom - 1); pt[3] = new Point(recBounds.Left + 1, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Left + 1, recBounds.Top + 3); pt[5] = new Point(recBounds.Left + 3, recBounds.Top + 1); pt[6] = new Point(recBounds.Right, recBounds.Top + 1); } break; case TabAlignment.Right: { pt[0] = new Point(recBounds.Left, recBounds.Top + 1); pt[1] = new Point(recBounds.Right - 3, recBounds.Top + 1); pt[2] = new Point(recBounds.Right - 1, recBounds.Top + 3); pt[3] = new Point(recBounds.Right - 1, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom - 1); pt[5] = new Point(recBounds.Left, recBounds.Bottom - 1); pt[6] = new Point(recBounds.Left, recBounds.Top + 1); } break; } //---------------------------- // fill this tab with background color //Brush br1 = new SolidBrush(Color.FromArgb(119,140,166)); using (Pen pen1 = new Pen(Color.FromArgb(91, 125, 170))) { g.DrawPolygon(pen1, pt); } #endregion //---------------------------- // clear bottom lines Pen pen = new Pen(tabPage.BackColor); switch (_owner.Alignment) { case TabAlignment.Top: g.DrawLine(pen, recBounds.Left + 2, recBounds.Bottom, recBounds.Right - 2, recBounds.Bottom); g.DrawLine(pen, recBounds.Left + 2, recBounds.Bottom + 1, recBounds.Right - 2, recBounds.Bottom + 1); break; case TabAlignment.Bottom: g.DrawLine(pen, recBounds.Left + 2, recBounds.Top, recBounds.Right - 2, recBounds.Top); g.DrawLine(pen, recBounds.Left + 2, recBounds.Top - 1, recBounds.Right - 2, recBounds.Top - 1); break; case TabAlignment.Left: g.DrawLine(pen, recBounds.Right + 1, recBounds.Top + 2, recBounds.Right + 1, recBounds.Bottom - 2); g.DrawLine(pen, recBounds.Right, recBounds.Top + 2, recBounds.Right, recBounds.Bottom - 2); break; case TabAlignment.Right: g.DrawLine(pen, recBounds.Left - 1, recBounds.Top + 2, recBounds.Left - 1, recBounds.Bottom - 2); g.DrawLine(pen, recBounds.Left, recBounds.Top + 2, recBounds.Left, recBounds.Bottom - 2); break; } pen.Dispose(); //---------------------------- } else if (bHovered)//如果不是选中,是hover状态 { Color tabBackColor = Color.FromArgb(61, 84, 115); Color tabBorderColor = Color.FromArgb(19, 28, 37); Color tabBorderInnerColor = Color.FromArgb(89, 114, 145); Point[] pt = new Point[7]; switch (_owner.Alignment) { case TabAlignment.Top: { pt[0] = new Point(recBounds.Left, recBounds.Bottom); pt[1] = new Point(recBounds.Left, recBounds.Top + 3); pt[2] = new Point(recBounds.Left + 3, recBounds.Top); pt[3] = new Point(recBounds.Right - 3, recBounds.Top); pt[4] = new Point(recBounds.Right, recBounds.Top + 3); pt[5] = new Point(recBounds.Right, recBounds.Bottom); pt[6] = new Point(recBounds.Left, recBounds.Bottom); } break; case TabAlignment.Bottom: { pt[0] = new Point(recBounds.Left, recBounds.Top); pt[1] = new Point(recBounds.Right, recBounds.Top); pt[2] = new Point(recBounds.Right, recBounds.Bottom - 3); pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom); pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom); pt[5] = new Point(recBounds.Left, recBounds.Bottom - 3); pt[6] = new Point(recBounds.Left, recBounds.Top); } break; case TabAlignment.Left: { pt[0] = new Point(recBounds.Right, recBounds.Top); pt[1] = new Point(recBounds.Right, recBounds.Bottom); pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom); pt[3] = new Point(recBounds.Left, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Left, recBounds.Top + 3); pt[5] = new Point(recBounds.Left + 3, recBounds.Top); pt[6] = new Point(recBounds.Right, recBounds.Top); } break; case TabAlignment.Right: { pt[0] = new Point(recBounds.Left, recBounds.Top); pt[1] = new Point(recBounds.Right - 3, recBounds.Top); pt[2] = new Point(recBounds.Right, recBounds.Top + 3); pt[3] = new Point(recBounds.Right, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom); pt[5] = new Point(recBounds.Left, recBounds.Bottom); pt[6] = new Point(recBounds.Left, recBounds.Top); } break; } //---------------------------- // fill this tab with background color Brush br = new SolidBrush(tabBackColor); g.FillPolygon(br, pt); br.Dispose(); //---------------------------- //---------------------------- // draw border using (Pen pen1 = new Pen(tabBorderColor)) { g.DrawPolygon(pen1, pt); } #region 内边框 switch (_owner.Alignment) { case TabAlignment.Top: { pt[0] = new Point(recBounds.Left + 1, recBounds.Bottom); pt[1] = new Point(recBounds.Left + 1, recBounds.Top + 3); pt[2] = new Point(recBounds.Left + 3, recBounds.Top + 1); pt[3] = new Point(recBounds.Right - 3, recBounds.Top + 1); pt[4] = new Point(recBounds.Right - 1, recBounds.Top + 3); pt[5] = new Point(recBounds.Right - 1, recBounds.Bottom); pt[6] = new Point(recBounds.Left + 1, recBounds.Bottom); } break; case TabAlignment.Bottom: { pt[0] = new Point(recBounds.Left + 1, recBounds.Top); pt[1] = new Point(recBounds.Right - 1, recBounds.Top); pt[2] = new Point(recBounds.Right - 1, recBounds.Bottom - 3); pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom - 1); pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom - 1); pt[5] = new Point(recBounds.Left + 1, recBounds.Bottom - 3); pt[6] = new Point(recBounds.Left + 1, recBounds.Top); } break; case TabAlignment.Left: { pt[0] = new Point(recBounds.Right, recBounds.Top + 1); pt[1] = new Point(recBounds.Right, recBounds.Bottom - 1); pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom - 1); pt[3] = new Point(recBounds.Left + 1, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Left + 1, recBounds.Top + 3); pt[5] = new Point(recBounds.Left + 3, recBounds.Top + 1); pt[6] = new Point(recBounds.Right, recBounds.Top + 1); } break; case TabAlignment.Right: { pt[0] = new Point(recBounds.Left, recBounds.Top + 1); pt[1] = new Point(recBounds.Right - 3, recBounds.Top + 1); pt[2] = new Point(recBounds.Right - 1, recBounds.Top + 3); pt[3] = new Point(recBounds.Right - 1, recBounds.Bottom - 3); pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom - 1); pt[5] = new Point(recBounds.Left, recBounds.Bottom - 1); pt[6] = new Point(recBounds.Left, recBounds.Top + 1); } break; } //---------------------------- // fill this tab with background color //Brush br1 = new SolidBrush(Color.FromArgb(119,140,166)); using (Pen pen1 = new Pen(tabBorderInnerColor)) { g.DrawPolygon(pen1, pt); } #endregion //---------------------------- // clear bottom lines Pen pen = new Pen(tabBorderColor); switch (_owner.Alignment) { case TabAlignment.Top: g.DrawLine(pen, recBounds.Left + 1, recBounds.Bottom, recBounds.Right - 1, recBounds.Bottom); //g.DrawLine(pen, recBounds.Left + 1, recBounds.Bottom - 2, recBounds.Right - 1, recBounds.Bottom - 2); break; case TabAlignment.Bottom: g.DrawLine(pen, recBounds.Left + 1, recBounds.Top, recBounds.Right - 1, recBounds.Top); //g.DrawLine(pen, recBounds.Left + 1, recBounds.Top - 1, recBounds.Right - 1, recBounds.Top - 1); break; case TabAlignment.Left: g.DrawLine(pen, recBounds.Right, recBounds.Top + 1, recBounds.Right, recBounds.Bottom - 1); //g.DrawLine(pen, recBounds.Right - 1, recBounds.Top + 1, recBounds.Right - 1, recBounds.Bottom - 1); break; case TabAlignment.Right: g.DrawLine(pen, recBounds.Left, recBounds.Top + 1, recBounds.Left, recBounds.Bottom - 1); //g.DrawLine(pen, recBounds.Left + 1, recBounds.Top + 1, recBounds.Left + 1, recBounds.Bottom - 1); break; } pen.Dispose(); } //---------------------------- //---------------------------- // draw tab's icon if ((tabPage.ImageIndex >= 0) && (_owner.ImageList != null) && (_owner.ImageList.Images[tabPage.ImageIndex] != null)) { int nLeftMargin = 8; int nRightMargin = 2; Image img = _owner.ImageList.Images[tabPage.ImageIndex]; Rectangle rimage = new Rectangle(recBounds.X + nLeftMargin, recBounds.Y + 1, img.Width, img.Height); // adjust rectangles float nAdj = (float)(nLeftMargin + img.Width + nRightMargin); rimage.Y += (recBounds.Height - img.Height) / 2; tabTextArea.X += nAdj; tabTextArea.Width -= nAdj; // draw icon g.DrawImage(img, rimage); } //---------------------------- //---------------------------- // draw string StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; if (bSelected) { using (SolidBrush br = new SolidBrush(Color.White)) { g.DrawString(tabPage.Text, _owner.Font, br, tabTextArea, stringFormat); } } else { using (SolidBrush br = new SolidBrush(Color.FromArgb(147, 170, 199))) { g.DrawString(tabPage.Text, _owner.Font, br, tabTextArea, stringFormat); } } //---------------------------- }
/// <summary> /// Paints the column header cell, including the drop-down button. /// </summary> /// <param name="graphics">The Graphics used to paint the DataGridViewCell.</param> /// <param name="clipBounds">A Rectangle that represents the area of the DataGridView that needs to be repainted.</param> /// <param name="cellBounds">A Rectangle that contains the bounds of the DataGridViewCell that is being painted.</param> /// <param name="rowIndex">The row index of the cell that is being painted.</param> /// <param name="cellState">A bitwise combination of DataGridViewElementStates values that specifies the state of the cell.</param> /// <param name="value">The data of the DataGridViewCell that is being painted.</param> /// <param name="formattedValue">The formatted data of the DataGridViewCell that is being painted.</param> /// <param name="errorText">An error message that is associated with the cell.</param> /// <param name="cellStyle">A DataGridViewCellStyle that contains formatting and style information about the cell.</param> /// <param name="advancedBorderStyle">A DataGridViewAdvancedBorderStyle that contains border styles for the cell that is being painted.</param> /// <param name="paintParts">A bitwise combination of the DataGridViewPaintParts values that specifies which parts of the cell need to be painted.</param> protected override void Paint(System.Drawing.Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); // Continue only if the drop down is to be visible and ContentBackground is part of the paint request. if (!this.IsProgrammaticSorting || (paintParts & DataGridViewPaintParts.ContentBackground) == 0) { return; } Rectangle buttonBounds = this.DropDownButtonBounds; if (buttonBounds.Width > 0 && buttonBounds.Height > 0) // make sure there's something to draw... { // Paint the button manually or using visual styles if visual styles // are enabled, using the correct state depending on whether the // filter list is showing and whether there is a filter in effect // for the current column. if (Application.RenderWithVisualStyles) { ComboBoxState state = ComboBoxState.Normal; if (!this.DropDownEnabled) state = ComboBoxState.Disabled; else if (this.IsDropDownShowing) state = ComboBoxState.Pressed; ComboBoxRenderer.DrawDropDownButton(graphics, buttonBounds, state); } else { int pressedOffset = 0; PushButtonState state = PushButtonState.Normal; if (!this.DropDownEnabled) { state = PushButtonState.Disabled; } else if (this.IsDropDownShowing) { state = PushButtonState.Pressed; pressedOffset = 1; } ButtonRenderer.DrawButton(graphics, buttonBounds, state); graphics.FillPolygon(this.DropDownEnabled ? SystemBrushes.ControlText : SystemBrushes.InactiveCaption, new Point[] { new Point( buttonBounds.Width/2 + buttonBounds.Left - 1 + pressedOffset, buttonBounds.Height*3/4 + buttonBounds.Top - 1 + pressedOffset), new Point( buttonBounds.Width/4 + buttonBounds.Left + pressedOffset, buttonBounds.Height/2 + buttonBounds.Top - 1 + pressedOffset), new Point( buttonBounds.Width*3/4 + buttonBounds.Left - 1 + pressedOffset, buttonBounds.Height/2 + buttonBounds.Top - 1 + pressedOffset) }); } // and then paint a filtering and/or sorting glyph if(_filtered) { Bitmap glyph = Properties.Resources.FilterHeaderCellGlyph; Rectangle cbb = this.DataGridView.GetCellDisplayRectangle(this.ColumnIndex, -1, false); graphics.DrawImage(glyph, new Rectangle(buttonBounds.Left - glyph.Width - 3, (cbb.Height - glyph.Height) / 2, glyph.Width, glyph.Height)); } } }
public override void RenderCustomChart(Character character, string chartName, System.Drawing.Graphics g, int width, int height) { Rectangle rectSubPoint; System.Drawing.Drawing2D.LinearGradientBrush brushSubPointFill; System.Drawing.Drawing2D.ColorBlend blendSubPoint; CalculationOptionsMage calculationOptions = character.CalculationOptions as CalculationOptionsMage; Font fontLegend = new Font("Verdana", 10f, GraphicsUnit.Pixel); int legendY; Brush[] brushSubPoints; Color[] colorSubPointsA; Color[] colorSubPointsB; float graphStart; float graphWidth; float graphTop; float graphBottom; float graphHeight; float maxScale; float graphEnd; float[] ticks; Pen black200 = new Pen(Color.FromArgb(200, 0, 0, 0)); Pen black150 = new Pen(Color.FromArgb(150, 0, 0, 0)); Pen black75 = new Pen(Color.FromArgb(75, 0, 0, 0)); Pen black50 = new Pen(Color.FromArgb(50, 0, 0, 0)); Pen black25 = new Pen(Color.FromArgb(25, 0, 0, 0)); StringFormat formatTick = new StringFormat(); formatTick.LineAlignment = StringAlignment.Far; formatTick.Alignment = StringAlignment.Center; Brush black200brush = new SolidBrush(Color.FromArgb(200, 0, 0, 0)); Brush black150brush = new SolidBrush(Color.FromArgb(150, 0, 0, 0)); Brush black75brush = new SolidBrush(Color.FromArgb(75, 0, 0, 0)); Brush black50brush = new SolidBrush(Color.FromArgb(50, 0, 0, 0)); Brush black25brush = new SolidBrush(Color.FromArgb(25, 0, 0, 0)); string[] statNames = new string[] { "11.7 Spell Power", "4 Mana per 5 sec", "10 Crit Rating", "10 Haste Rating", "10 Hit Rating", "10 Intellect", "10 Spirit" }; Color[] statColors = new Color[] { Color.FromArgb(255, 255, 0, 0), Color.DarkBlue, Color.FromArgb(255, 255, 165, 0), Color.Olive, Color.FromArgb(255, 154, 205, 50), Color.Aqua, Color.FromArgb(255, 0, 0, 255) }; DisplayCalculations calculations = calculationOptions.Calculations; List<float> X = new List<float>(); List<ComparisonCalculationBase[]> Y = new List<ComparisonCalculationBase[]>(); height -= 2; Stats[] statsList = new Stats[] { new Stats() { SpellPower = 1.17f }, new Stats() { Mp5 = 0.4f }, new Stats() { CritRating = 1 }, new Stats() { HasteRating = 1 }, new Stats() { HitRating = 1 }, new Stats() { Intellect = 1 }, new Stats() { Spirit = 1 }, }; switch (chartName) { case "Stats Graph": Base.Graph.RenderStatsGraph(g, width, height, character, statsList, statColors, 100, "", "Dps Rating", Base.Graph.Style.Mage); break; case "Proc Uptime": List<SpecialEffect> effectList = new List<SpecialEffect>(); effectList.AddRange(calculations.SpellPowerEffects); effectList.AddRange(calculations.HasteRatingEffects); #region Legend legendY = 2; Color[] colors = new Color[] { Color.FromArgb(255,202,180,96), Color.FromArgb(255,101,225,240), Color.FromArgb(255,0,4,3), Color.FromArgb(255,238,238,30), Color.FromArgb(255,45,112,63), Color.FromArgb(255,121,72,210), Color.FromArgb(255,217,100,54), Color.FromArgb(255,210,72,195), Color.FromArgb(255,206,189,191), Color.FromArgb(255,255,0,0), Color.FromArgb(255,0,255,0), Color.FromArgb(255,0,0,255), }; brushSubPoints = new Brush[effectList.Count]; colorSubPointsA = new Color[effectList.Count]; colorSubPointsB = new Color[effectList.Count]; for (int i = 0; i < effectList.Count; i++) { Color baseColor = colors[i]; brushSubPoints[i] = new SolidBrush(Color.FromArgb(baseColor.R / 2, baseColor.G / 2, baseColor.B / 2)); colorSubPointsA[i] = Color.FromArgb(baseColor.A / 2, baseColor.R / 2, baseColor.G / 2, baseColor.B / 2); colorSubPointsB[i] = Color.FromArgb(baseColor.A / 2, baseColor); } for (int i = 0; i < effectList.Count; i++) { g.DrawLine(new Pen(colors[i]), new Point(20, legendY + 7), new Point(50, legendY + 7)); //g.DrawString(effectList[i].ToString(), fontLegend, Brushes.Black, new Point(60, legendY)); legendY += 16; } #endregion #region Graph Ticks graphStart = 30f; graphWidth = width - 50f; graphTop = legendY; graphBottom = height - 4 - 4 * effectList.Count; graphHeight = graphBottom - graphTop - 40; maxScale = calculationOptions.FightDuration; graphEnd = graphStart + graphWidth; ticks = new float[] {(float)Math.Round(graphStart + graphWidth * 0.5f), (float)Math.Round(graphStart + graphWidth * 0.75f), (float)Math.Round(graphStart + graphWidth * 0.25f), (float)Math.Round(graphStart + graphWidth * 0.125f), (float)Math.Round(graphStart + graphWidth * 0.375f), (float)Math.Round(graphStart + graphWidth * 0.625f), (float)Math.Round(graphStart + graphWidth * 0.875f)}; for (int i = 0; i <= 10; i++) { float h = (float)Math.Round(graphBottom - graphHeight * i / 10.0); g.DrawLine(black25, graphStart - 4, h, graphEnd, h); //g.DrawLine(black200, graphStart - 4, h, graphStart, h); g.DrawString((i / 10.0).ToString("F1"), fontLegend, black200brush, graphStart - 15, h + 6, formatTick); } g.DrawLine(black150, ticks[1], graphTop + 36, ticks[1], graphTop + 39); g.DrawLine(black150, ticks[2], graphTop + 36, ticks[2], graphTop + 39); g.DrawLine(black75, ticks[3], graphTop + 36, ticks[3], graphTop + 39); g.DrawLine(black75, ticks[4], graphTop + 36, ticks[4], graphTop + 39); g.DrawLine(black75, ticks[5], graphTop + 36, ticks[5], graphTop + 39); g.DrawLine(black75, ticks[6], graphTop + 36, ticks[6], graphTop + 39); g.DrawLine(black75, graphEnd, graphTop + 41, graphEnd, height - 4); g.DrawLine(black75, ticks[0], graphTop + 41, ticks[0], height - 4); g.DrawLine(black50, ticks[1], graphTop + 41, ticks[1], height - 4); g.DrawLine(black50, ticks[2], graphTop + 41, ticks[2], height - 4); g.DrawLine(black25, ticks[3], graphTop + 41, ticks[3], height - 4); g.DrawLine(black25, ticks[4], graphTop + 41, ticks[4], height - 4); g.DrawLine(black25, ticks[5], graphTop + 41, ticks[5], height - 4); g.DrawLine(black25, ticks[6], graphTop + 41, ticks[6], height - 4); g.DrawLine(black200, graphStart - 4, graphTop + 40, graphEnd + 4, graphTop + 40); g.DrawLine(black200, graphStart, graphTop + 36, graphStart, height - 4); g.DrawLine(black200, graphEnd, graphTop + 36, graphEnd, height - 4); g.DrawLine(black200, graphStart - 4, graphBottom, graphEnd + 4, graphBottom); g.DrawString(TimeFormat(0f), fontLegend, black200brush, graphStart, graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale), fontLegend, black200brush, graphEnd, graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.5f), fontLegend, black200brush, ticks[0], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.75f), fontLegend, black150brush, ticks[1], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.25f), fontLegend, black150brush, ticks[2], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.125f), fontLegend, black75brush, ticks[3], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.375f), fontLegend, black75brush, ticks[4], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.625f), fontLegend, black75brush, ticks[5], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.875f), fontLegend, black75brush, ticks[6], graphTop + 36, formatTick); #endregion for (int i = 0; i < effectList.Count; i++) { float procs = 0.0f; float triggers = 0.0f; for (int j = 0; j < calculations.SolutionVariable.Count; j++) { if (calculations.Solution[j] > 0) { Cycle c = calculations.SolutionVariable[j].Cycle; if (c != null) { switch (effectList[i].Trigger) { case Trigger.DamageSpellCrit: case Trigger.SpellCrit: triggers += (float)calculations.Solution[j] * c.Ticks / c.CastTime; procs += (float)calculations.Solution[j] * c.CritProcs / c.CastTime; break; case Trigger.DamageSpellHit: case Trigger.SpellHit: triggers += (float)calculations.Solution[j] * c.Ticks / c.CastTime; procs += (float)calculations.Solution[j] * c.HitProcs / c.CastTime; break; case Trigger.SpellMiss: triggers += (float)calculations.Solution[j] * c.Ticks / c.CastTime; procs += (float)calculations.Solution[j] * (1 - c.HitProcs) / c.CastTime; break; case Trigger.DamageSpellCast: case Trigger.SpellCast: if (effectList[i].Stats.ValkyrDamage > 0) { triggers += (float)calculations.Solution[j] * c.CastProcs2 / c.CastTime; procs += (float)calculations.Solution[j] * c.CastProcs2 / c.CastTime; } else { triggers += (float)calculations.Solution[j] * c.CastProcs / c.CastTime; procs += (float)calculations.Solution[j] * c.CastProcs / c.CastTime; } break; case Trigger.MageNukeCast: triggers += (float)calculations.Solution[j] * c.NukeProcs / c.CastTime; procs += (float)calculations.Solution[j] * c.NukeProcs / c.CastTime; break; case Trigger.DamageDone: case Trigger.DamageOrHealingDone: triggers += (float)calculations.Solution[j] * c.DamageProcs / c.CastTime; procs += (float)calculations.Solution[j] * c.DamageProcs / c.CastTime; break; case Trigger.DoTTick: triggers += (float)calculations.Solution[j] * c.DotProcs / c.CastTime; procs += (float)calculations.Solution[j] * c.DotProcs / c.CastTime; break; } } } } float triggerInterval = calculations.CalculationOptions.FightDuration / triggers; float triggerChance = Math.Min(1.0f, procs / triggers); int steps = 200; PointF[] plot = new PointF[steps + 1]; for (int tick = 0; tick <= steps; tick++) { float time = tick / (float)steps * calculations.CalculationOptions.FightDuration; plot[tick] = new PointF(graphStart + time / maxScale * graphWidth, graphBottom - graphHeight * effectList[i].GetUptimePlot(triggerInterval, triggerChance, 3.0f, time)); } g.DrawLines(new Pen(colors[i]), plot); g.DrawString(string.Format("{0} (average uptime {1:F}%)", effectList[i], effectList[i].GetAverageUptime(triggerInterval, triggerChance, 3.0f, calculations.CalculationOptions.FightDuration) * 100), fontLegend, Brushes.Black, new Point(60, 2 + i * 16)); } break; case "Sequence Reconstruction": if (calculationOptions.SequenceReconstruction == null) { g.DrawString("Sequence reconstruction data is not available.", fontLegend, Brushes.Black, 2, 2); } else { #region Legend legendY = 2; List<EffectCooldown> cooldownList = calculationOptions.Calculations.CooldownList; brushSubPoints = new Brush[cooldownList.Count]; colorSubPointsA = new Color[cooldownList.Count]; colorSubPointsB = new Color[cooldownList.Count]; for (int i = 0; i < cooldownList.Count; i++) { Color baseColor = cooldownList[i].Color; brushSubPoints[i] = new SolidBrush(Color.FromArgb(baseColor.R / 2, baseColor.G / 2, baseColor.B / 2)); colorSubPointsA[i] = Color.FromArgb(baseColor.A / 2, baseColor.R / 2, baseColor.G / 2, baseColor.B / 2); colorSubPointsB[i] = Color.FromArgb(baseColor.A / 2, baseColor); } StringFormat formatSubPoint = new StringFormat(); formatSubPoint.Alignment = StringAlignment.Center; formatSubPoint.LineAlignment = StringAlignment.Center; int maxWidth = 1; for (int i = 0; i < cooldownList.Count; i++) { string subPointName = cooldownList[i].Name; int widthSubPoint = (int)Math.Ceiling(g.MeasureString(subPointName, fontLegend).Width + 2f); if (widthSubPoint > maxWidth) maxWidth = widthSubPoint; } for (int i = 0; i < cooldownList.Count; i++) { string cooldownName = cooldownList[i].Name; rectSubPoint = new Rectangle(2, legendY, maxWidth, 16); blendSubPoint = new System.Drawing.Drawing2D.ColorBlend(3); blendSubPoint.Colors = new Color[] { colorSubPointsA[i], colorSubPointsB[i], colorSubPointsA[i] }; blendSubPoint.Positions = new float[] { 0f, 0.5f, 1f }; brushSubPointFill = new System.Drawing.Drawing2D.LinearGradientBrush(rectSubPoint, colorSubPointsA[i], colorSubPointsB[i], 67f); brushSubPointFill.InterpolationColors = blendSubPoint; g.FillRectangle(brushSubPointFill, rectSubPoint); g.DrawRectangle(new Pen(brushSubPointFill), rectSubPoint); g.DrawRectangle(new Pen(brushSubPointFill), rectSubPoint); g.DrawRectangle(new Pen(brushSubPointFill), rectSubPoint); g.DrawString(cooldownName, fontLegend, brushSubPoints[i], rectSubPoint, formatSubPoint); legendY += 16; } if (calculationOptions.AdviseAdvancedSolver) { g.DrawString("Sequence Reconstruction was not fully successful, it is recommended that you enable more options in advanced solver (segment cooldowns, integral mana consumables, advanced constraints options)!", fontLegend, Brushes.Black, new RectangleF(5 + maxWidth, 40, width - maxWidth - 10, 100)); } g.DrawLine(Pens.Aqua, new Point(maxWidth + 40, 10), new Point(maxWidth + 80, 10)); g.DrawString("Mana", fontLegend, Brushes.Black, new Point(maxWidth + 90, 2)); g.DrawLine(Pens.Red, new Point(maxWidth + 40, 26), new Point(maxWidth + 80, 26)); g.DrawString("Dps", fontLegend, Brushes.Black, new Point(maxWidth + 90, 18)); #endregion #region Graph Ticks graphStart = 20f; graphWidth = width - 40f; graphTop = legendY; graphBottom = height - 4 - 4 * cooldownList.Count; graphHeight = graphBottom - graphTop - 40; maxScale = calculationOptions.FightDuration; graphEnd = graphStart + graphWidth; ticks = new float[] {(float)Math.Round(graphStart + graphWidth * 0.5f), (float)Math.Round(graphStart + graphWidth * 0.75f), (float)Math.Round(graphStart + graphWidth * 0.25f), (float)Math.Round(graphStart + graphWidth * 0.125f), (float)Math.Round(graphStart + graphWidth * 0.375f), (float)Math.Round(graphStart + graphWidth * 0.625f), (float)Math.Round(graphStart + graphWidth * 0.875f)}; g.DrawLine(black150, ticks[1], graphTop + 36, ticks[1], graphTop + 39); g.DrawLine(black150, ticks[2], graphTop + 36, ticks[2], graphTop + 39); g.DrawLine(black75, ticks[3], graphTop + 36, ticks[3], graphTop + 39); g.DrawLine(black75, ticks[4], graphTop + 36, ticks[4], graphTop + 39); g.DrawLine(black75, ticks[5], graphTop + 36, ticks[5], graphTop + 39); g.DrawLine(black75, ticks[6], graphTop + 36, ticks[6], graphTop + 39); g.DrawLine(black75, graphEnd, graphTop + 41, graphEnd, height - 4); g.DrawLine(black75, ticks[0], graphTop + 41, ticks[0], height - 4); g.DrawLine(black50, ticks[1], graphTop + 41, ticks[1], height - 4); g.DrawLine(black50, ticks[2], graphTop + 41, ticks[2], height - 4); g.DrawLine(black25, ticks[3], graphTop + 41, ticks[3], height - 4); g.DrawLine(black25, ticks[4], graphTop + 41, ticks[4], height - 4); g.DrawLine(black25, ticks[5], graphTop + 41, ticks[5], height - 4); g.DrawLine(black25, ticks[6], graphTop + 41, ticks[6], height - 4); g.DrawLine(black200, graphStart - 4, graphTop + 40, graphEnd + 4, graphTop + 40); g.DrawLine(black200, graphStart, graphTop + 36, graphStart, height - 4); g.DrawLine(black200, graphEnd, graphTop + 36, graphEnd, height - 4); g.DrawLine(black200, graphStart - 4, graphBottom, graphEnd + 4, graphBottom); g.DrawString(TimeFormat(0f), fontLegend, black200brush, graphStart, graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale), fontLegend, black200brush, graphEnd, graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.5f), fontLegend, black200brush, ticks[0], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.75f), fontLegend, black150brush, ticks[1], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.25f), fontLegend, black150brush, ticks[2], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.125f), fontLegend, black75brush, ticks[3], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.375f), fontLegend, black75brush, ticks[4], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.625f), fontLegend, black75brush, ticks[5], graphTop + 36, formatTick); g.DrawString(TimeFormat(maxScale * 0.875f), fontLegend, black75brush, ticks[6], graphTop + 36, formatTick); #endregion List<SequenceReconstruction.SequenceItem> sequence = calculationOptions.SequenceReconstruction.sequence; float mana = calculations.StartingMana; int gemCount = 0; float time = 0; Color manaFill = Color.FromArgb(50, Color.FromArgb(255, 0, 0, 255)); float lastMana = mana; float maxMana = calculations.BaseStats.Mana; float maxDps = 100; for (int i = 0; i < sequence.Count; i++) { int index = sequence[i].Index; VariableType type = sequence[i].VariableType; float duration = (float)sequence[i].Duration; Cycle cycle = sequence[i].Cycle; if (cycle != null && cycle.DamagePerSecond > maxDps) maxDps = cycle.DamagePerSecond; CastingState state = sequence[i].CastingState; float mps = (float)sequence[i].Mps; if (sequence[i].IsManaPotionOrGem) { duration = 0; if (sequence[i].VariableType == VariableType.ManaGem) { mana += (float)((1 + calculations.BaseStats.BonusManaGem) * calculations.ManaGemValue); gemCount++; } else if (sequence[i].VariableType == VariableType.ManaPotion) { mana += (float)((1 + calculations.BaseStats.BonusManaPotion) * calculations.ManaPotionValue); } if (mana < 0) mana = 0; if (mana > maxMana) { mana = maxMana; } g.DrawLine(Pens.Aqua, graphStart + time / maxScale * graphWidth, graphBottom - graphHeight * lastMana / maxMana, graphStart + time / maxScale * graphWidth, height - 44 - graphHeight * mana / maxMana); } else { if (sequence[i].IsEvocation) { switch (sequence[i].VariableType) { case VariableType.Evocation: mps = -(float)calculationOptions.Calculations.EvocationRegen; break; case VariableType.EvocationIV: mps = -(float)calculationOptions.Calculations.EvocationRegenIV; break; case VariableType.EvocationHero: mps = -(float)calculationOptions.Calculations.EvocationRegenHero; break; case VariableType.EvocationIVHero: mps = -(float)calculationOptions.Calculations.EvocationRegenIVHero; break; } } float partTime = duration; if (mana - mps * duration < 0) partTime = mana / mps; else if (mana - mps * duration > maxMana) partTime = (mana - maxMana) / mps; mana -= mps * duration; if (mana < 0) mana = 0; if (mana > maxMana) { mana = maxMana; } float x1 = graphStart + time / maxScale * graphWidth; float x2 = graphStart + (time + partTime) / maxScale * graphWidth; float x3 = graphStart + (time + duration) / maxScale * graphWidth; float y1 = graphBottom - graphHeight * lastMana / maxMana; float y2 = graphBottom - graphHeight * mana / maxMana; float y3 = graphBottom; g.FillPolygon(new SolidBrush(manaFill), new PointF[] { new PointF(x1, y1), new PointF(x2, y2), new PointF(x3, y2), new PointF(x3, y3), new PointF(x1, y3) }); g.DrawLine(Pens.Aqua, x1, y1, x2, y2); g.DrawLine(Pens.Aqua, x2, y2, x3, y2); } lastMana = mana; time += duration; } maxDps *= 1.1f; List<PointF> list = new List<PointF>(); time = 0.0f; for (int i = 0; i < sequence.Count; i++) { int index = sequence[i].Index; VariableType type = sequence[i].VariableType; float duration = (float)sequence[i].Duration; Cycle cycle = sequence[i].Cycle; CastingState state = sequence[i].CastingState; float mps = (float)sequence[i].Mps; if (sequence[i].IsManaPotionOrGem) duration = 0; float dps = 0; if (cycle != null) { dps = cycle.DamagePerSecond; } if (duration > 0) { list.Add(new PointF(graphStart + (time + 0.1f * duration) / maxScale * graphWidth, graphBottom - graphHeight * dps / maxDps)); list.Add(new PointF(graphStart + (time + 0.9f * duration) / maxScale * graphWidth, graphBottom - graphHeight * dps / maxDps)); } time += duration; } if (list.Count > 0) g.DrawLines(Pens.Red, list.ToArray()); for (int cooldown = 0; cooldown < cooldownList.Count; cooldown++) { blendSubPoint = new System.Drawing.Drawing2D.ColorBlend(3); blendSubPoint.Colors = new Color[] { colorSubPointsA[cooldown], colorSubPointsB[cooldown], colorSubPointsA[cooldown] }; blendSubPoint.Positions = new float[] { 0f, 0.5f, 1f }; bool on = false; float timeOn = 0.0f; time = 0; for (int i = 0; i < sequence.Count; i++) { float duration = (float)sequence[i].Duration; if (sequence[i].IsManaPotionOrGem) duration = 0; if (on && !sequence[i].CastingState.EffectsActive(cooldownList[cooldown]) && !sequence[i].IsManaPotionOrGem) { on = false; if (time > timeOn) { RectangleF rect = new RectangleF(graphStart + graphWidth * timeOn / maxScale, graphBottom + cooldown * 4, graphWidth * (time - timeOn) / maxScale, 4); brushSubPointFill = new System.Drawing.Drawing2D.LinearGradientBrush(rect, colorSubPointsA[cooldown], colorSubPointsB[cooldown], 67f); brushSubPointFill.InterpolationColors = blendSubPoint; g.FillRectangle(brushSubPointFill, rect); g.DrawRectangle(new Pen(brushSubPointFill), rect.X, rect.Y, rect.Width, rect.Height); g.DrawRectangle(new Pen(brushSubPointFill), rect.X, rect.Y, rect.Width, rect.Height); g.DrawRectangle(new Pen(brushSubPointFill), rect.X, rect.Y, rect.Width, rect.Height); } } else if (!on && sequence[i].CastingState.EffectsActive(cooldownList[cooldown])) { on = true; timeOn = time; } time += duration; } if (on) { if (time - timeOn > 0) { RectangleF rect = new RectangleF(graphStart + graphWidth * timeOn / maxScale, graphBottom + cooldown * 4, graphWidth * (time - timeOn) / maxScale, 4); brushSubPointFill = new System.Drawing.Drawing2D.LinearGradientBrush(rect, colorSubPointsA[cooldown], colorSubPointsB[cooldown], 67f); brushSubPointFill.InterpolationColors = blendSubPoint; g.FillRectangle(brushSubPointFill, rect); g.DrawRectangle(new Pen(brushSubPointFill), rect.X, rect.Y, rect.Width, rect.Height); g.DrawRectangle(new Pen(brushSubPointFill), rect.X, rect.Y, rect.Width, rect.Height); g.DrawRectangle(new Pen(brushSubPointFill), rect.X, rect.Y, rect.Width, rect.Height); } } } } break; case "Scaling vs Spell Power": Base.Graph.RenderScalingGraph(g, width, height, character, statsList, new Stats() { SpellPower = 5 }, true, statColors, 100, "", "Dps Rating", Base.Graph.Style.Mage); break; case "Scaling vs Crit Rating": Base.Graph.RenderScalingGraph(g, width, height, character, statsList, new Stats() { CritRating = 5 }, true, statColors, 100, "", "Dps Rating", Base.Graph.Style.Mage); break; case "Scaling vs Haste Rating": Base.Graph.RenderScalingGraph(g, width, height, character, statsList, new Stats() { HasteRating = 5 }, true, statColors, 100, "", "Dps Rating", Base.Graph.Style.Mage); break; case "Scaling vs Intellect": Base.Graph.RenderScalingGraph(g, width, height, character, statsList, new Stats() { Intellect = 5 }, true, statColors, 100, "", "Dps Rating", Base.Graph.Style.Mage); break; case "Scaling vs Spirit": Base.Graph.RenderScalingGraph(g, width, height, character, statsList, new Stats() { Spirit = 5 }, true, statColors, 100, "", "Dps Rating", Base.Graph.Style.Mage); break; } }
void renklendir(Brush brush, System.Drawing.Graphics grap,ulke[] ulkeler) { brush = new SolidBrush(Durum.sırakimde.renkoku()); grap.FillPolygon(brush, ulkeler[1].ulke_Koordinat); }
private void RenderTab(System.Drawing.Graphics g, int index) { var rect = GetTabRect(index); var closeRect = GetCloseRect(index); var selected = SelectedIndex == index; var tab = TabPages[index]; var points = new[] { new Point(rect.Left, rect.Bottom), new Point(rect.Left, rect.Top + 3), new Point(rect.Left + 3, rect.Top), new Point(rect.Right - 3, rect.Top), new Point(rect.Right, rect.Top + 3), new Point(rect.Right, rect.Bottom), new Point(rect.Left, rect.Bottom) }; // Background var p = PointToClient(MousePosition); var hoverClose = closeRect.Contains(p); var hover = rect.Contains(p); var backColour = tab.BackColor; if (selected) backColour = ControlPaint.Light(backColour, 1); else if (hover) backColour = ControlPaint.Light(backColour, 0.8f); using (var b = new SolidBrush(backColour)) { g.FillPolygon(b, points); } // Border g.SmoothingMode = SmoothingMode.AntiAlias; g.DrawPolygon(SystemPens.ControlDark, points); if (selected) { using (var pen = new Pen(tab.BackColor)) { g.DrawLine(pen, rect.Left, rect.Bottom, rect.Right, rect.Bottom); } } // Text var textRect = new Rectangle(rect.X + 14, rect.Y + 5, rect.Width - 26, rect.Height - 5); using (var b = new SolidBrush(tab.ForeColor)) { g.DrawString(tab.Text, Font, b, textRect); } // Close icon using (var pen = new Pen(tab.ForeColor)) { if (hoverClose) { g.DrawRectangle(pen, closeRect.Left + 1, closeRect.Top + 1, closeRect.Width - 2, closeRect.Height - 2); } const int padding = 5; g.DrawLine(pen, closeRect.Left + padding, closeRect.Top + padding, closeRect.Right - padding, closeRect.Bottom - padding); g.DrawLine(pen, closeRect.Right - padding, closeRect.Top + padding, closeRect.Left + padding, closeRect.Bottom - padding); } }