MeasureString() pads the text on the left and the right

后端 未结 5 834
野趣味
野趣味 2021-01-04 01:54

I\'m using GDI+ in C++. (This issue might exist in C# too).

I notice that whenever I call Graphics::MeasureString() or Graphics::DrawString(), the string is padded

5条回答
  •  清歌不尽
    2021-01-04 02:09

    Append StringFormat.GenericTypographic will fix your issue:

    graphics->MeasureString(L"PP", 1, font, width, StringFormat.GenericTypographic);
    

    Apply the same attribute to DrawString.

提交回复
热议问题