private static void SetRectangleProperties(Rectangle rect, Properties attributes) {
String value;
value = attributes[ElementTags.BORDERWIDTH];
if (value != null) {
rect.BorderWidth = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
int border = 0;
if (Utilities.CheckTrueOrFalse(attributes, ElementTags.LEFT)) {
border |= Rectangle.LEFT_BORDER;
}
if (Utilities.CheckTrueOrFalse(attributes, ElementTags.RIGHT)) {
border |= Rectangle.RIGHT_BORDER;
}
if (Utilities.CheckTrueOrFalse(attributes, ElementTags.TOP)) {
border |= Rectangle.TOP_BORDER;
}
if (Utilities.CheckTrueOrFalse(attributes, ElementTags.BOTTOM)) {
border |= Rectangle.BOTTOM_BORDER;
}
rect.Border = border;
String r = attributes[ElementTags.RED];
String g = attributes[ElementTags.GREEN];
String b = attributes[ElementTags.BLUE];
if (r != null || g != null || b != null) {
int red = 0;
int green = 0;
int blue = 0;
if (r != null) red = int.Parse(r);
if (g != null) green = int.Parse(g);
if (b != null) blue = int.Parse(b);
rect.BorderColor = new Color(red, green, blue);
}
else {
rect.BorderColor = Markup.DecodeColor(attributes[ElementTags.BORDERCOLOR]);
}
r = (String)attributes.Remove(ElementTags.BGRED);
g = (String)attributes.Remove(ElementTags.BGGREEN);
b = (String)attributes.Remove(ElementTags.BGBLUE);
value = attributes[ElementTags.BACKGROUNDCOLOR];
if (r != null || g != null || b != null) {
int red = 0;
int green = 0;
int blue = 0;
if (r != null) red = int.Parse(r);
if (g != null) green = int.Parse(g);
if (b != null) blue = int.Parse(b);
rect.BackgroundColor = new Color(red, green, blue);
}
else if (value != null) {
rect.BackgroundColor = Markup.DecodeColor(value);
}
else {
value = attributes[ElementTags.GRAYFILL];
if (value != null) {
rect.GrayFill = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
}
}