GraphicsUnit Conversion

  • Thread starter Thread starter Gugale at Lincoln
  • Start date Start date
G

Gugale at Lincoln

I am using a ComboBox to choose font. I am displaying each font name in its
own font. I am having trouble adjusting spacing between two ComboBox items.
Statement e.ItemHeight = font.Height doesn't do the job because unit for
font.Height can differ. Any suggestions on how to convert font.Height unit
to match e.ItemHeight?

Thanks
SG
private void cbFonts_MeasureItem(object sender,
System.Windows.Forms.MeasureItemEventArgs e)

{

FontFamily fontFamily = (FontFamily) cbFonts.Items[e.Index];

Font font = new Font(fontFamily.Name, 12, GetFontStyle(fontFamily));

e.ItemHeight = font.Height;

e.ItemWidth = 100;

}
 
Back
Top