问题描述
下面的代码在标有粗体的行给我错误.它说''object.GetType()是一种"方法,在给定的上下文中无效",请大家帮忙.
System.Reflection.PropertyInfo Imageproperty =默认值(System.Reflection.PropertyInfo);
Imageproperty = flowLayoutPanel1.GetType.GetProperty("Image", typeof(Image));
如果(Imageproperty == null)
{
位图imgNew =新位图(flowLayoutPanel1.Width,flowLayoutPanel1.Height);
flowLayoutPanel1.DrawToBitmap(imgNew,flowLayoutPanel1.ClientRectangle);
返回imgNew;
}
其他
{
return(Image)Imageproperty.GetValue(flowLayoutPanel1,null);
}
below code gives me error at the line marked bold.it says "''object.GetType()'' is a ''method'', which is not valid in the given context" plz any one can help me out.
System.Reflection.PropertyInfo Imageproperty = default(System.Reflection.PropertyInfo);
Imageproperty = flowLayoutPanel1.GetType.GetProperty("Image", typeof(Image));
if (Imageproperty == null)
{
Bitmap imgNew = new Bitmap(flowLayoutPanel1.Width, flowLayoutPanel1.Height);
flowLayoutPanel1.DrawToBitmap(imgNew, flowLayoutPanel1.ClientRectangle);
return imgNew;
}
else
{
return (Image)Imageproperty.GetValue(flowLayoutPanel1, null);
}
推荐答案
这篇关于'object.GetType()'是一个'方法',在给定的上下文中无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!