static void DrawKeys(KeystrokesSettings KeystrokesSettings, IEditableFrame Editor, string Text, IFont Font, byte Opacity, float OffsetY) { var size = Editor.MeasureString(Text, Font); int paddingX = KeystrokesSettings.HorizontalPadding, paddingY = KeystrokesSettings.VerticalPadding; var rect = new RectangleF(GetLeft(KeystrokesSettings, Editor.Width, size.Width), GetTop(KeystrokesSettings, Editor.Height, size.Height, OffsetY), size.Width + 2 * paddingX, size.Height + 2 * paddingY); Editor.FillRectangle(Color.FromArgb(Opacity, KeystrokesSettings.BackgroundColor), rect, KeystrokesSettings.CornerRadius); Editor.DrawString(Text, Font, Color.FromArgb(Opacity, KeystrokesSettings.FontColor), new RectangleF(rect.Left + paddingX, rect.Top + paddingY, size.Width, size.Height)); var border = KeystrokesSettings.BorderThickness; if (border > 0) { rect = new RectangleF(rect.Left - border / 2f, rect.Top - border / 2f, rect.Width + border, rect.Height + border); Editor.DrawRectangle(Color.FromArgb(Opacity, KeystrokesSettings.BorderColor), border, rect, KeystrokesSettings.CornerRadius); } }
public virtual void Draw(IEditableFrame editor, Func <Point, Point> pointTransform = null) { if (!_overlaySettings.Display) { return; } var text = GetText(); if (string.IsNullOrWhiteSpace(text)) { return; } var fontSize = _overlaySettings.FontSize; var size = editor.MeasureString(text, fontSize); 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, fontSize, _overlaySettings.FontColor, new RectangleF(rect.Left + paddingX, rect.Top + paddingY, size.Width, size.Height)); var border = _overlaySettings.BorderThickness; if (border <= 0) { return; } 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); } } }