CP-6317: Importing from branch clearwater-ln.

# HG changeset patch
# User Konstantina Chremmou <Konstantina.Chremmou@citrix.com>
# Date 1377007835 -3600
# Node ID a1c6bcf2b4d3119cff54d87fb97bd2491c9d8f67
# Parent  41c2dfb11187cbc91b4f874b1df8c06524aad3c7
CA-113310: Corrected string measurement which was causing truncation on SC and a
lot of white space on EN and JA versions.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2013-09-26 14:33:50 +01:00
parent 5737060c5b
commit 307646d0a9

View File

@ -82,17 +82,17 @@ namespace XenAdmin.Controls
{
get
{
using (Graphics graphics = CreateGraphics())
int longest = 0;
foreach (var item in Items)
{
int longest = 0;
foreach (var item in Items)
{
int stringLength = (int) graphics.MeasureString(item.ToString(), Font).Width;
if (stringLength > longest)
longest = stringLength;
}
return longest;
//CA-113310: use TextRenderer rather than Graphics to measure
//the string because it will be placed on a winforms control
//with the default UseCompatibleTextRendering value (false)
int stringLength = TextRenderer.MeasureText(item.ToString(), Font).Width;
if (stringLength > longest)
longest = stringLength;
}
return longest;
}
}