using System.Drawing;
using System.ComponentModel;
using FastReport.Utils;
using System.Drawing.Design;
namespace FastReport.Gauge
{
///
/// Represents a pointer of gauge.
///
#if !DEBUG
[DesignTimeVisible(false)]
#endif
public class GaugePointer : Component
{
#region Fields
private GaugeObject parent;
private FillBase fill;
private float borderWidth;
private Color borderColor;
#endregion // Fields
#region Properties
///
/// Gets or sets the parent gauge object.
///
[Browsable(false)]
public GaugeObject Parent
{
get { return parent; }
set { parent = value; }
}
///
/// Gets or sets the color of a pointer.
///
[Browsable(true)]
[Editor("FastReport.TypeEditors.FillEditor, FastReport", typeof(UITypeEditor))]
public FillBase Fill
{
get { return fill; }
set { fill = value; }
}
///
/// Gets or sets the border width of a pointer.
///
[Browsable(false)]
public float BorderWidth
{
get { return borderWidth; }
set { borderWidth = value; }
}
///
/// Gets or sets the border color of a pointer.
///
[Browsable(true)]
public Color BorderColor
{
get { return borderColor; }
set { borderColor = value; }
}
#endregion // Properties
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The parent gauge object.
public GaugePointer(GaugeObject parent)
{
fill = new SolidFill(Color.Orange);
borderWidth = 1.0f;
borderColor = Color.Black;
this.parent = parent;
}
#endregion // Constructors
#region Public Methods
///
/// Copies the contents of another GaugePointer.
///
/// The GaugePointer instance to copy the contents from.
public virtual void Assign(GaugePointer src)
{
Fill = src.Fill.Clone();
BorderWidth = src.BorderWidth;
BorderColor = src.BorderColor;
}
///
/// Draws the gauge pointer.
///
/// Draw event arguments.
public virtual void Draw(FRPaintEventArgs e)
{
}
///
/// Serializes the gauge pointer.
///
/// Writer object.
/// Gauge pointer property name.
/// Another GaugePointer to compare with.
///
/// This method is for internal use only.
///
public virtual void Serialize(FRWriter writer, string prefix, GaugePointer diff)
{
Fill.Serialize(writer, prefix + ".Fill", diff.Fill);
if (BorderWidth != diff.BorderWidth)
{
writer.WriteFloat(prefix + ".BorderWidth", BorderWidth);
}
if (BorderColor != diff.BorderColor)
{
writer.WriteValue(prefix + ".BorderColor", BorderColor);
}
}
#endregion // Public Methods
}
}