none
Determine the Height of a single line TextBox using GetSystemMetrics RRS feed

  • Question

  • Hi,

    I would like to set the Height a multiline textbox proportional to the Height of a non-multiline textbox, i.e. 20 * [number of lines].

    Is there a parameter I can use to retrieve this via the GetSystemMetrics method in a similar way to how I am getting the Width of a vertical scroll bar (SM_CXVSCROLL) ? Or is there any alternative method?

    I could use 20 and multiple this by a factor for VGA screens however it would be better to get this without requiring calculations.

    Thanks

    Paul Diston


    http://www.smartmobiledevice.co.uk/
    Tuesday, April 27, 2010 5:54 PM

Answers

  • Use DrawText along with DT_CALCRECT as uFormat.

    If You want to have a concreate width, simply create a RECT with set width and height = 0. DrawText will calculate height accordingly.


    If You'll find my answer satisfactory or helpful - mark it as answered or vote for it! Thank You.
    If You think You know better then me, why is Your code not working, then don't waste my time at this forum. Otherwise - do as I'm suggesting.

    I'm on MSDN just like MD House in the clinic. But I'm also a human which sometimes needs to see another doctor :)
    • Marked as answer by Paul Diston Wednesday, April 28, 2010 8:15 AM
    Wednesday, April 28, 2010 6:00 AM