[ACCEPTED]-How to set line spacing Graphics.DrawString-graphics

Accepted answer
Score: 10

This MSDN should help you. Line spacing is a result 3 of the Font you are using. You may need 2 to break your DrawString commands up into 1 multiple calls if you need custom line spacing.

Score: 2

This Microsoft forum posting may be helpful:


This 12 shows how MeasureString can be used to determine 11 how much of your text will fit on each line, then 10 using this to progressively render the entire 9 rectangle's contents line by line. Unfortunately 8 I don't think there's a built-in line spacing 7 property, so you'll have to go for the manual 6 approach. The post's author uses the font's 5 Height * 1.5.

It's also worth researching 4 StringFormatFlags - you'll need to make 3 sure both your DrawString and MeasureString 2 calls use the same StringFormat so the rendering 1 and measurement are consistent:


More Related questions