public override void Draw() { var rb = RenderBounds; WidgetUtils.FillRectWithColor(rb, GetColor()); D2WidgetUtils.DrawPanelBorder(rb, BarMargin); }
public override void Draw() { var rb = RenderBounds; D2WidgetUtils.DrawLine( new float2(rb.Left, rb.Top), new float2(rb.Right, rb.Bottom), Size, GetColor()); }
public override void Draw() { if (GetPercentage == null) { return; } var rb = RenderBounds; var r = new Rectangle(rb.Left, rb.Top, rb.Width, rb.Height - 3 * BarMargin); var percentage = GetPercentage(); var backgroundColor = Color.FromArgb(186, 190, 150); WidgetUtils.FillRectWithColor(rb, backgroundColor); D2WidgetUtils.DrawPanelBorder(r, BarMargin); D2WidgetUtils.DrawRedTriangle(new int2(r.Left + BarMargin * 2, r.Bottom), BarMargin); D2WidgetUtils.DrawYellowTriangle(new int2((r.Left + r.Right) / 2, r.Bottom), BarMargin); D2WidgetUtils.DrawGreenTriangle(new int2(r.Right - 2 * BarMargin, r.Bottom), BarMargin); var minBarWidth = 1; var maxBarWidth = r.Width - BarMargin * 2; var barWidth = percentage * maxBarWidth / 100; barWidth = Math.Max(barWidth, minBarWidth); var barRect = new Rectangle(r.X + BarMargin, r.Y + BarMargin, barWidth, r.Height - 2 * BarMargin); var barColor = Color.FromArgb(85, 254, 81); if (percentage < 25) { barColor = Color.FromArgb(168, 0, 0); } else if (percentage < 50) { barColor = Color.FromArgb(254, 251, 84); } WidgetUtils.FillRectWithColor(barRect, barColor); }
public static void D2DrawBackground(Color color, int margin, Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted) { WidgetUtils.FillRectWithColor(rect, color); D2WidgetUtils.DrawPanelBorder(rect, margin, pressed || highlighted); }