string
)以及属性所在的对象(如
object
).
这里有一些代码可以让它更具体一些:
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
{
// The next line is made up code
var currentValue = source.Current.CoolMethodToTakePropertyNameAndReturnValue(MappingName);
// Paint out the retrieved value
g.DrawString(currentValue.ToString() , _gridFont, new SolidBrush(Color.Black), bounds.Left + 1, bounds.Top);
}
MappingName是我要为其获取值的属性的名称。我需要的是
CoolMethodToTakePropertyNameAndReturnValue
.
谢谢你的帮助。