registerForGraphicUpdate ();\r
}\r
}\r
- [XmlAttributeAttribute()][DefaultValue(2)]\r
+ [XmlAttributeAttribute()][DefaultValue(2.0)]\r
public virtual double CornerRadius {\r
get { return _cornerRadius; }\r
set {\r
\r
DefaultValueAttribute dv = o as DefaultValueAttribute;\r
if (dv != null) {\r
- if (pi.PropertyType == typeof(Color))\r
- pi.SetValue (this, Color.Parse ((string)dv.Value), null);\r
- else if (pi.PropertyType == typeof(Font))\r
- pi.SetValue (this, Font.Parse ((string)dv.Value), null);\r
- else if (pi.PropertyType == typeof(Picture))\r
- pi.SetValue (this, Picture.Parse ((string)dv.Value), null);\r
- else if (pi.PropertyType == typeof(Size))\r
- pi.SetValue (this, Size.Parse ((string)dv.Value), null);\r
- else\r
- pi.SetValue (this, dv.Value, null);\r
- continue;\r
- }\r
-\r
- //Debug.WriteLine (o.ToString ());\r
+ object defaultValue = dv.Value;\r
+ //avoid system types automaticaly converted by parser\r
+ if (defaultValue != null && !pi.PropertyType.Namespace.StartsWith("System")) {\r
+ if (pi.PropertyType != defaultValue.GetType()) {\r
+ MethodInfo miParse = pi.PropertyType.GetMethod ("Parse", BindingFlags.Static | BindingFlags.Public);\r
+ if (miParse != null) { \r
+ pi.SetValue (this, miParse.Invoke (null, new object[]{ defaultValue }), null);\r
+ continue;\r
+ }\r
+ }\r
+ }\r
+ pi.SetValue (this, defaultValue, null); \r
+ } \r
}\r
}\r
-\r
}\r
\r
public virtual GraphicObject FindByName(string nameToFind){\r
string v = reader.GetAttribute (name);\r
\r
if (string.IsNullOrEmpty (v)) {\r
- //TODO: maybe find another way to convert correctely colors default values\r
- if (pi.PropertyType == typeof(Color))\r
- pi.SetValue (this, Color.Parse ((string)defaultValue), null);\r
- else if (pi.PropertyType == typeof(Font))\r
- pi.SetValue (this, Font.Parse ((string)defaultValue), null);\r
- else if (pi.PropertyType == typeof(Picture))\r
- pi.SetValue (this, Picture.Parse ((string)defaultValue), null);\r
- else if (pi.PropertyType == typeof(Size))\r
- pi.SetValue (this, Size.Parse ((string)defaultValue), null);\r
- else\r
- pi.SetValue (this, defaultValue, null);\r
+ //avoid system types automaticaly converted by parser\r
+ if (defaultValue != null && !pi.PropertyType.Namespace.StartsWith("System")) {\r
+ if (pi.PropertyType != defaultValue.GetType()) {\r
+ MethodInfo miParse = pi.PropertyType.GetMethod ("Parse", BindingFlags.Static | BindingFlags.Public);\r
+ if (miParse != null) { \r
+ pi.SetValue (this, miParse.Invoke (null, new object[]{ defaultValue }), null);\r
+ continue;\r
+ }\r
+ }\r
+ }\r
+\r
+ pi.SetValue (this, defaultValue, null);\r
+\r
} else {\r
+ \r
if (v.StartsWith("{")) {\r
//binding\r
if (!v.EndsWith("}"))\r
if (HasFocus)\r
{\r
//TODO:\r
- gr.Color = Color.White;\r
+ gr.Color = Foreground;\r
gr.LineWidth = 1.5;\r
gr.MoveTo(new PointD(textCursorPos + rText.X, rText.Y + currentLine * fe.Height));\r
gr.LineTo(new PointD(textCursorPos + rText.X, rText.Y + (currentLine + 1) * fe.Height));\r
gr.Stroke();\r
}\r
#endregion\r
- \r
+\r
+ //*******************\r
+ //debug selection\r
// gr.Color = Color.Green;\r
// Rectangle R = new Rectangle(\r
// rText.X + (int)SelEndCursorPos-10,\r
// (int)fe.Height);\r
// gr.Rectangle(R);\r
// gr.Fill();\r
+ //*******************\r
\r
gr.FontMatrix = new Matrix(widthRatio * Font.Size, 0, 0, heightRatio * Font.Size, 0, 0);\r
\r