public override bool Draw(IRichPane rp) { if (IsMasking) { var sr = rp.GetPaneRect(); rp.Graphics.DrawString("PAUSE", _font, Brushes.DarkGray, sr.LT.X + 48, sr.RB.Y - 42); } else { // Left side RED curtain var sr = rp.GetPaneRect(); var W = 240; var rc1 = ScreenRect.FromLTWH(sr.LT.X, sr.LT.Y, W, sr.Height); rp.Graphics.FillRectangle(new LinearGradientBrush(new Point(0, 0), new PointF(W, 0), Color.FromArgb(128, 255, 0, 0), Color.FromArgb(0, 255, 0, 0)), rc1); // Now pointer RED curtain var now = DateTime.Now; now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); var rc2 = GetScRect(rp, CodeRect.FromLTRB((int)(now - Hot.FirstSpeech).TotalSeconds, 0, 0, 0)); rc2 = ScreenRect.FromLTRB(rc2.LT.X, sr.LT.Y, sr.RB.X, sr.RB.Y); rp.Graphics.FillRectangle(new LinearGradientBrush(new Point(rc2.LT.X, rc2.LT.Y), new PointF(rc2.RB.X, rc2.RB.Y), Color.FromArgb(8, 255, 0, 0), Color.FromArgb(96, 255, 0, 0)), rc2); // REC LABEL if (++_cnt % 2 == 0) { rp.Graphics.DrawString("REC", _font, Brushes.Yellow, sr.LT.X + 48, sr.RB.Y - 42); } } return(true); }
public override void Draw(DrawProperty dp) { if (Visible) { var sr = ScreenRect.FromLTRB(Left.Cx, Top.Cy, Right.Cx, Bottom.Cy); dp.Graphics.FillRectangle(_(sr), MaskBG); dp.Graphics.FillRectangle(_(sr), MaskPen); } }
private void Pane_SizeChanged(object sender, EventArgs e) { if (LogParts != null) { var r = Pane.GetPaneRect(); LogParts.SetMargin(ScreenRect.FromLTRB(r.RB.X - 480, 0, 0, 0)); } else { Timer.AddTrigger(200, () => { Pane_SizeChanged(this, EventArgs.Empty); }); } }
/// <summary> /// caluclate the maximum screen rectangle of the all specified partsset /// </summary> /// <param name="pane"></param> /// <param name="partsset"></param> /// <returns></returns> public static ScreenRect GetScreenPosArea(IDrawArea pane, IEnumerable <PartsBase <TCX, TCY> > partsset) { float l = float.PositiveInfinity, t = float.PositiveInfinity, r = float.NegativeInfinity, b = float.NegativeInfinity; foreach (var parts in partsset) { var spos = parts.GetScreenPos(pane); if (spos.X < l) { l = spos.X; } if (spos.Y < t) { t = spos.Y; } if (spos.X > r) { r = spos.X; } if (spos.Y > b) { b = spos.Y; } } if (float.IsPositiveInfinity(l)) { return(ScreenRect.FromLTRB(0, 0, 0, 0)); } else { return(ScreenRect.FromLTRB(l, t, r, b)); } }
public override bool Draw(IRichPane rp) { var paneRect = rp.GetPaneRect(); var sr0 = GetScRect(rp); var sr = ScreenRect.FromLTRB(paneRect.LT.X, paneRect.LT.Y, paneRect.RB.X, paneRect.LT.Y + sr0.Height); rp.Graphics.SmoothingMode = SmoothingMode.HighQuality; rp.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(64, 0, 32, 64)), sr); // Background var nowr = GetScRect(rp, CodeRect.FromLTRB((int)(DateTime.Now - Hot.FirstSpeech).TotalSeconds, 0, 0, 0)); var span = GetSpan(rp); var sec1 = GetCdPos(rp, sr.LT).X; // Code.X --> Seconds from Hot.FirstSpeech var sec0 = sec1 / span * span; int sec; for (sec = sec0; ; sec += span) { var time = Hot.FirstSpeech + TimeSpan.FromSeconds(sec); if (time + TimeSpan.FromSeconds(1) > DateTime.Now) { break; } var r = GetScRect(rp, CodeRect.FromLTRB(sec, 0, 0, 0)); if (r.LT.X > sr.RB.X) { break; } // LINE if (Math.Abs(r.LT.X - nowr.LT.X) > 8) { rp.Graphics.DrawLine(new Pen(Color.FromArgb((time.Second % 10 == 0 ? 128 : 72), Color.SteelBlue), 0.5f), r.LT.X, sr.RB.Y - (time.Second == 0 ? 8 : 2), r.LT.X, paneRect.RB.Y); } // SECOND LABEL if (time.Second != 0 && Math.Abs(r.LT.X - nowr.LT.X) > 16) { rp.Graphics.DrawString(time.ToString("ss"), FontSec, Brushes.DarkGray, r.LT.X, sr.RB.Y - 6, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); } } span = Math.Max(span, 60); sec = sec / span * span; var x = paneRect.RB.X + 999; for (; ; sec -= span) { var time = Hot.FirstSpeech + TimeSpan.FromSeconds(sec); if (time >= DateTime.Now) { continue; } var r = GetScRect(rp, CodeRect.FromLTRB(sec, 0, 0, 0)); // TIME LABEL var a = (int)Math.Max(0.0, Math.Min((double)(x - 32) / 110 * 255, 255)); var br = a >= 255 ? Brushes.White : new SolidBrush(Color.FromArgb(a, Color.White)); x = Math.Max(r.LT.X, 16); if (Math.Abs(x - nowr.LT.X) > 36) { rp.Graphics.DrawString(time.ToString(TimeUtil.FormatHM), FontTime, br, x, sr.LT.Y + 2, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); } if (r.LT.X < 0) { break; } } // DRAW NOW { // LINE rp.Graphics.DrawLine(Pens.DarkGreen, nowr.LT.X, sr.RB.Y, nowr.LT.X, paneRect.RB.Y); // SECOND LABEL rp.Graphics.DrawString(DateTime.Now.ToString("ss"), FontSecNow, Brushes.LimeGreen, nowr.LT.X, sr.RB.Y - 8, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); // TIME LABEL rp.Graphics.DrawString(DateTime.Now.ToString(TimeUtil.FormatHM), FontTimeNow, Brushes.LimeGreen, nowr.LT.X, sr.LT.Y + 1, new StringFormat { Alignment = StringAlignment.Center, Trimming = StringTrimming.None, }); } // rp.Graphics.DrawLine(Pens.White, paneRect.RT, paneRect.LB); // for TEST return(true); }