CodePudding user response:
Can use Graphics. MeasureString to measure the layout after the specified string rendering,https://docs.microsoft.com/zh-cn/dotnet/api/system.drawing.graphics.measurestring
CodePudding user response:
Cycle to adjust the font size, test so as to adapt to the required width,CodePudding user response:
To measure the width and height of the font. It is the most simple, set a LABEL to AUTOSIZE, then set the font LABEL font size to the same goals, sets the TEXT to the target content. Take the LABEL's W, H value (there is a small error, want to fine-tune the).There is also a method in Drawing is similar to the above, can also measure the font width and height.
CodePudding user response:
You can get the text, this problem has been solved, rewriting is not finished? The location? Fontsize? Fontfamiliy? These also become a problem?CodePudding user response:
Learning PS, DrawText on an image first, and then stretched to fill,