GDI+ How to set line-spacing for draw text? RRS feed

  • Question

  • User1740964576 posted


    I managed to draw text in a bounded rectangle. The text wraps correctly.

    However, the space between the lines of the text is too big. I want to reduce line spacing.

    Is it possible ?

    Monday, December 8, 2008 9:37 AM


  • User-1136466523 posted


    From your description, it seems that what you are using is the drawText method with a “DT_WORDBREAK” uFormat parameter, right?

    If you though the space between the lines of the text is too big, then you have to wrap the words manually. After you got the string to be draw, you have to split the string into a string array according to a proper width (length per word * word numbers), and draw each string item to the image in the specific position you defined manually. In this way, you can control the space between two lines.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 12, 2008 2:06 AM