How to use MeasureString in C# to set table column width?

前端 未结 3 1997
花落未央
花落未央 2021-01-27 00:59

I have a pretty quick (and I\'m hoping basic) question. I\'m modifying some C# code for my company\'s website. The code draws a table for me in fixed columns, the data for which

3条回答
  •  广开言路
    2021-01-27 01:01

    You can either use e.Graphics.MeasureString() or TextRenderer.MeasureText()

    Differences and advantages of each of them are describe here:

    TextRenderer.MeasureText and Graphics.MeasureString mismatch in size

    There you will also find usage examples, which I would skip here to avoid duplication.

提交回复
热议问题