Saturday, 7 September 2013

How to conver float to sizeF?

How to conver float to sizeF?

I have a panel where i am wring an string to a rectangle by default i have
set the width of panel 300 that i am setting to a variable of type float,
and i wring some string to it, but i want to identify that next item being
drawn can be adapted to remaining space or i need to start it from new row
i am calculating the remaining space like below. But it can not cast float
to 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 +
", ";
}

No comments:

Post a Comment