public void Draw(IEditableFrame Editor, Func <Point, Point> PointTransform = null) { if (!_settings.Display) { return; } if (_records?.Last == null) { return; } var offsetY = 0f; var fontSize = _settings.FontSize; byte opacity = 255; var index = 0; foreach (var keyRecord in _records) { ++index; if ((DateTime.Now - keyRecord.TimeStamp).TotalSeconds > _records.Size * _settings.Timeout) { continue; } using (var font = Editor.GetFont(_settings.FontFamily, Math.Max(1, fontSize))) { DrawKeys(_settings, Editor, keyRecord.Display, font, opacity, offsetY); var height = Editor.MeasureString("A", font).Height; offsetY += height + _settings.HistorySpacing; offsetY += _settings.VerticalPadding * 2 + _settings.BorderThickness * 2; } if (index == 1) { fontSize -= 5; opacity = 200; } } }
public virtual void Draw(IEditableFrame Editor, Func <Point, Point> PointTransform = null) { if (!_overlaySettings.Display) { return; } var text = GetText(); if (string.IsNullOrWhiteSpace(text)) { return; } var font = Editor.GetFont(_overlaySettings.FontFamily, _overlaySettings.FontSize); var size = Editor.MeasureString(text, font); int paddingX = _overlaySettings.HorizontalPadding, paddingY = _overlaySettings.VerticalPadding; var rect = new RectangleF(GetLeft(_overlaySettings, Editor.Width, size.Width), GetTop(_overlaySettings, Editor.Height, size.Height), size.Width + 2 * paddingX, size.Height + 2 * paddingY); Editor.FillRectangle(_overlaySettings.BackgroundColor, rect, _overlaySettings.CornerRadius); Editor.DrawString(text, font, _overlaySettings.FontColor, new RectangleF(rect.Left + paddingX, rect.Top + paddingY, size.Width, size.Height)); var border = _overlaySettings.BorderThickness; if (border > 0) { rect = new RectangleF(rect.Left - border / 2f, rect.Top - border / 2f, rect.Width + border, rect.Height + border); Editor.DrawRectangle(_overlaySettings.BorderColor, border, rect, _overlaySettings.CornerRadius); } }
public override void Draw(IEditableFrame Editor, Func <Point, Point> PointTransform = null) { var curPos = Args.Location; if (PointTransform != null) { curPos = PointTransform(curPos); } float clickRadius = _settings.Radius; var d = clickRadius * 2; var x = curPos.X - clickRadius; var y = curPos.Y - clickRadius; var color = GetClickCircleColor(); Editor.FillEllipse(color, new RectangleF(x, y, d, d)); var border = _settings.BorderThickness; if (border > 0) { x -= border / 2f; y -= border / 2f; d += border; var borderColor = _settings.BorderColor; Editor.DrawEllipse(borderColor, border, new RectangleF(x, y, d, d)); } if (Args.Clicks > 1) { var font = Editor.GetFont("Arial", 15); Editor.DrawString(Args.Clicks.ToString(), font, Color.Black, new RectangleF(x + 10, y + 10, d, d)); } base.Draw(Editor, PointTransform); }
public static void DrawString(IEditableFrame Editor, string Text, KeystrokesSettings Settings) { if (string.IsNullOrWhiteSpace(Text)) { return; } using (var font = Editor.GetFont(Settings.FontFamily, Settings.FontSize)) { var size = Editor.MeasureString(Text, font); int paddingX = Settings.HorizontalPadding, paddingY = Settings.VerticalPadding; var rect = new RectangleF(KeyOverlay.GetLeft(Settings, Editor.Width, size.Width), KeyOverlay.GetTop(Settings, Editor.Height, size.Height), size.Width + 2 * paddingX, size.Height + 2 * paddingY); Editor.FillRectangle(Settings.BackgroundColor, rect, Settings.CornerRadius); Editor.DrawString(Text, font, Settings.FontColor, new RectangleF(rect.Left + paddingX, rect.Top + paddingY, size.Width, size.Height)); var border = Settings.BorderThickness; if (border > 0) { rect = new RectangleF(rect.Left - border / 2f, rect.Top - border / 2f, rect.Width + border, rect.Height + border); Editor.DrawRectangle(Settings.BorderColor, border, rect, Settings.CornerRadius); } } }