/// <summary>
/// 计算字符串长度
/// </summary>
/// <returns>字符串长度</returns>
private int GetMaxTextLength()
{
string strMax = "";
foreach (string strText in m_cmbExportType.Items)
{
if (strMax.Length < strText.Length)
strMax = strText;
}
int iTextLength = (int)listView.CreateGraphics().MeasureString(strMax, this.Font).Width;
return iTextLength;
}
本文来自优快云博客,转载请标明出处:http://blog.youkuaiyun.com/myh0305/archive/2008/01/03/2012387.aspx
本文介绍了一个用于计算列表中字符串最大显示宽度的方法,该方法通过遍历列表中的每一项并测量其绘制宽度来确定最长字符串的实际宽度。

被折叠的 条评论
为什么被折叠?



