views:

81

answers:

1

Good Day,

I am working with a WinForms application and I need to programatically determine the height of a ListView row.

I am able to determine the height of the text using Graphics.MeasureString, but there's some padding above and below the text.

I am not customizing each row, I just need the height. How would I go about doing that?

TIA,

coson

A: 

I think I found my answer.

if (lv.Items.Count > 0)
{
Rectangle r = lvMain.Items[0].Bounds;
String rowFormat = String.Format("Height: {0}", r.Height);
MessageBox.Show(rowFormat, "Alert!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

coson