本文整理汇总了C#中PropertyInfo.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyInfo.GetType方法的具体用法?C# PropertyInfo.GetType怎么用?C# PropertyInfo.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyInfo
的用法示例。
在下文中一共展示了PropertyInfo.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPropertyObject
private void SetPropertyObject(object objParent, PropertyInfo pi, XmlTextReader tr, NodeStyle ns)
{
object obj;
switch (pi.PropertyType.FullName)
{
case "System.Drawing.Font" :
structFont fnt;
fnt.Style = 0;
fnt.Unit = GraphicsUnit.Point;
fnt.Name="";
fnt.Size=0;
fnt.gdiCharSet=0;
fnt.gdiVerticalFont=false;
for (int i = 0; i < tr.AttributeCount; i++)
{
tr.MoveToAttribute(i);
switch (tr.Name.ToUpper())
{
case "NAME" : fnt.Name = tr.Value; break;
case "SIZE" : fnt.Size = Convert.ToSingle(tr.Value); break;
case "GDICHARSET" : fnt.gdiCharSet = Convert.ToByte(tr.Value); break;
case "GDIVERTICALFONT" : fnt.gdiVerticalFont = Convert.ToBoolean(tr.Value); break;
case "BOLD" : if (Convert.ToBoolean(tr.Value)) fnt.Style = fnt.Style | FontStyle.Bold ; break;
case "ITALIC" : if (Convert.ToBoolean(tr.Value)) fnt.Style = fnt.Style | FontStyle.Italic ; break;
case "STRIKEOUT" : if (Convert.ToBoolean(tr.Value)) fnt.Style = fnt.Style | FontStyle.Strikeout ; break;
case "UNDERLINE" : if (Convert.ToBoolean(tr.Value)) fnt.Style = fnt.Style | FontStyle.Underline; break;
case "UNIT" :
Type o = oTV.Style.NodeStyle.Font.Unit.GetType();
fnt.Unit = (System.Drawing.GraphicsUnit)System.Enum.Parse(o , tr.Value, true);
break;
default :
break;
}
}
System.Drawing.Font NewFont = new System.Drawing.Font(fnt.Name, fnt.Size, fnt.Style, fnt.Unit, fnt.gdiCharSet, fnt.gdiVerticalFont);
Type t1 = objParent.GetType();
switch (t1.FullName)
{
case "PureComponents.TreeView.NodeStyle" :
ns.Font = NewFont;
break;
case "PureComponents.TreeView.NodeTooltipStyle" :
ns.TooltipStyle.Font = NewFont;
break;
}
break;
default :
obj = (System.Type.GetType(pi.GetType().Name));
obj = pi.GetValue(objParent,null);
for (int i = 0; i < tr.AttributeCount; i++)
{
tr.MoveToAttribute(i);
SetProperty(obj, tr.Name, tr.Value);
}
break;
}
}