public Size MeasureText(string text, FontLabel font, Position position) { using var gdiFont = font.ToGdi(); using var gdiFormat = font.TextFormat.ToGdi(); var stringSize = _graph.MeasureString(text, gdiFont, position.ToGdi(), gdiFormat); return(Gdi.Size.Ceiling(stringSize).ToVisualizer()); }
public void DrawText(string text, FontLabel font, Position position) { if (!Validate(font.Brush)) { return; } using var gdiFont = font.ToGdi(); var gdiSize = _graph.MeasureString(text, gdiFont); using var gdiBrush = font.Brush.ToGdi(new Rectangle(position, gdiSize.ToVisualizer())); using var gdiFormat = font.TextFormat.ToGdi(); _graph.DrawString(text, gdiFont, gdiBrush, position.ToGdi(), gdiFormat); }