/// <summary> /// /// </summary> /// <param name="g"></param> private static void DrawCoverageRect(Graphics g, OrchShape os) { if (os != null && os.SelectionArea != null) { SelectionArea sa = os.SelectionArea; Font f = new Font("Arial", 8, FontStyle.Regular); int fontHeight = (int)f.GetHeight(); double shapeSuccessRate = os.GetSuccessRate(); string toolTipText = "Success Rate: " + (shapeSuccessRate == 0 ? "0" : shapeSuccessRate.ToString("###")) + "%"; int toolTipWidth = MeasureStringWidth(toolTipText, f); int toolTipHeight = f.Height + 6; int w = sa.Width + 6; int h = toolTipHeight; int x = sa.X - 2; int y = sa.Y - 2 - (h - ((h / 3))); float fttt = (float)toolTipWidth; float fw = (float)w; float fh = (float)h; float fx = (float)x; float fy = (float)y; Rectangle toolTipRect = new Rectangle(x, y, w, h); GraphicsPath gp = GetGpForShape(os); if (os.entryCount > 0) { if (shapeSuccessRate != 100) { // Blue g.FillRegion(new SolidBrush(Color.FromArgb(20, 0, 0, 255)), new Region(gp)); } else { // Green g.FillRegion(new SolidBrush(Color.FromArgb(20, 0, 255, 0)), new Region(gp)); } } else { // Red g.FillRegion(new SolidBrush(Color.FromArgb(20, 255, 0, 0)), new Region(gp)); } gp.Dispose(); g.FillRegion(new SolidBrush(Color.LemonChiffon), new Region(toolTipRect)); g.DrawRectangle(new Pen(Color.Black, 0.5f), toolTipRect); g.DrawString(toolTipText, f, new SolidBrush(Color.Black), ((sa.X + (sa.Width / 2)) - (fttt / 2)) + 3, y + 3); } return; }
public OrchShape(string text, string id, SelectionArea selectionArea) { this.Id = id; this.Text = text; this.SelectionArea = selectionArea; }
public OrchShape() { this.SelectionArea = new SelectionArea(0, 0, 0, 0); }