我有一个面板,默认情况下我将一个字符串拧成一个矩形正在绘制可以适应剩余空间,或者我需要从新行开始我正在计算剩余空间,如下所示。但它不能将浮点数转换为 sizeF。
foreach (btnObject custItem in this.lstAcceptedCustomizatio)
{
System.Drawing.SizeF newString = g.MeasureString(custItem.BtnName + ", ", this.Font); //get the size of the text property
System.Drawing.SizeF drawnString = g.MeasureString(basketItemDescription, this.Font); //get the size of the text property
if(newString.Width> (this.Width-drawnString)) //THIS LINE DO NOT WORK
basketItemDescription = basketItemDescription + custItem.BtnName + ", ";
}