using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using FastReport.Utils;
using System.Drawing.Design;
namespace FastReport
{
///
/// Represents text outline.
///
[ToolboxItem(false)]
[TypeConverter(typeof(FastReport.TypeConverters.FRExpandableObjectConverter))]
public class TextOutline// : Component
{
#region Fields
private bool enabled;
private Color color;
private float width;
private DashStyle style;
private bool drawbehind;
#endregion // Fields
#region Properties
///
/// Gets or sets a value indicating that outline is enabled.
///
[DefaultValue(false)]
[Browsable(true)]
public bool Enabled
{
get { return enabled; }
set { enabled = value; }
}
///
/// Enable or disable draw the outline behind of text.
///
[DefaultValue(false)]
[Browsable(true)]
public bool DrawBehind
{
get { return drawbehind; }
set { drawbehind = value; }
}
///
/// Gets or sets the outline color.
///
[Editor("FastReport.TypeEditors.ColorEditor, FastReport", typeof(UITypeEditor))]
public Color Color
{
get { return color; }
set { color = value; }
}
///
/// Gets or sets the outline width.
///
[DefaultValue(1.0f)]
[Browsable(true)]
public float Width
{
get { return width; }
set { width = value; }
}
///
/// Specifies the style of an outline.
///
[DefaultValue(DashStyle.Solid)]
[Browsable(true)]
public DashStyle Style
{
get { return style; }
set { style = value; }
}
#endregion // Properties
#region Constructors
///
/// Initializes a new instance of the class.
///
public TextOutline()
{
enabled = false;
color = Color.Black;
width = 1.0f;
style = DashStyle.Solid;
drawbehind = false;
}
///
/// Initializes a new instance of the class with specified parameters.
///
/// True if outline enabled.
/// Outline color.
/// Outline width.
/// Outline style.
/// True if outline should be drawn behind text.
public TextOutline(bool enabled, Color color, float width, DashStyle style, bool drawbehind)
{
this.enabled = enabled;
this.color = color;
this.width = width;
this.style = style;
this.drawbehind = drawbehind;
}
#endregion // Constructors
#region Public Methods
///
/// Copies the content of another TextOutline.
///
/// The TextOutline instance to copy the contents from.
public void Assign(TextOutline src)
{
enabled = src.Enabled;
color = src.Color;
width = src.Width;
style = src.Style;
drawbehind = src.DrawBehind;
}
///
/// Creates the exact copy of this outline.
///
/// Copy of this outline.
public TextOutline Clone()
{
return new TextOutline(enabled, color, width, style, drawbehind);
}
///
/// Serializes the TextOutline.
///
/// Writer object.
/// TextOutline property name.
/// Another TextOutline to compare with.
public void Serialize(FRWriter writer, string prefix, TextOutline diff)
{
if (enabled != diff.Enabled)
{
writer.WriteBool(prefix + ".Enabled", enabled);
}
if (color != diff.Color)
{
writer.WriteValue(prefix + ".Color", color);
}
if (width != diff.Width)
{
writer.WriteFloat(prefix + ".Width", width);
}
if (style != diff.Style)
{
writer.WriteValue(prefix + ".Style", style);
}
if (drawbehind != diff.DrawBehind)
{
writer.WriteBool(prefix + ".DrawBehind", drawbehind);
}
}
#endregion // Public Methods
}
}