I have a C# WinForms application which consists of server and client side. I use TextRenderer.MeasureText(string text, Font font)
method to measure text.
At some moment I need to measure text on server side, as if it was on client. I send Graphics.DpiX and Graphics.DpiY values from client to server. Based on that values, how can I measure text on server side? The key point is that client and server Dpi might be different.
I guess, I can create Graphics
object from Dpi values somehow and use TextRenderer.MeasureText(IDeviceContext dc, string text, Font font)
overload to measure my text. But how to create Graphics
from just DpiX and DpiY values?