float startPos = e.Graphics.MeasureString(toMeasure, f);
e.Graphics.DrawString(keyword, f, sb, new PointF(e.Bounds.X + (int)startPos, e.Bounds.Y));
这是f
:
using (Font f = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular))
这是toMeasure
:
string toMeasure = data[e.Index].Substring(0, keywords - 1);
错误在线:
float startPos = e.Graphics.MeasureString(toMeasure, f);
错误是:
无法将类型“System.Drawing.SizeF”隐式转换为“float”
我该如何解决?由于第二行应该浮动,但第一行不能从转换SizeF
为float
.