CPF/CPF.ReoGrid/XML/RGXmlBorder.cs
2024-06-24 10:15:59 +08:00

100 lines
1.8 KiB
C#

using System;
using System.Xml.Serialization;
using CPF.Drawing;
using CPF.ReoGrid.Common;
namespace CPF.ReoGrid.XML
{
public class RGXmlBorder
{
public RGXmlBorder()
{
}
internal RGXmlBorder(int row, int col, RangeBorderStyle borderStyle, string pos)
{
this.row = row;
this.col = col;
this.pos = pos;
bool flag = borderStyle.Color != Color.Black;
if (flag)
{
this.color = TextFormatHelper.EncodeColor(borderStyle.Color);
}
bool flag2 = borderStyle.Style != BorderLineStyle.Solid;
if (flag2)
{
this.style = borderStyle.Style.ToString();
}
}
[XmlIgnore]
internal RangeBorderStyle StyleGridBorder
{
get
{
bool flag = string.IsNullOrEmpty(this.style);
BorderLineStyle borderLineStyle;
if (flag)
{
borderLineStyle = BorderLineStyle.Solid;
}
else
{
bool flag2 = this.style.Equals("dot");
if (flag2)
{
borderLineStyle = BorderLineStyle.Dotted;
}
else
{
bool flag3 = this.style.Equals("dash");
if (flag3)
{
borderLineStyle = BorderLineStyle.Dashed;
}
else
{
borderLineStyle = (BorderLineStyle)Enum.Parse(typeof(BorderLineStyle), this.style, true);
}
}
}
bool flag4 = string.IsNullOrEmpty(this.color);
Color black;
if (flag4)
{
black = Color.Black;
}
else
{
bool flag5 = !TextFormatHelper.DecodeColor(this.color, out black);
if (flag5)
{
black = Color.Black;
}
}
return new RangeBorderStyle
{
Color = black,
Style = borderLineStyle
};
}
}
[XmlAttribute]
public int row;
[XmlAttribute]
public int col;
[XmlAttribute]
public string color;
[XmlAttribute]
public string style;
[XmlAttribute]
public string pos;
}
}