using System.Drawing; using System.ComponentModel; using FastReport.Utils; using System.Windows.Forms; namespace FastReport.Dialog { /// /// Implements base behavior of button controls. /// public partial class ButtonBaseControl : DataFilterBaseControl { #region Properties private ButtonBase Button { get { return Control as ButtonBase; } } /// /// Gets or sets a value that indicates whether the control resizes based on its contents. /// Wraps the property. /// [DefaultValue(true)] [Category("Behavior")] public virtual bool AutoSize { get { return Button.AutoSize; } set { Button.AutoSize = value; } } /// /// Gets or sets the image that is displayed on a button control. /// Wraps the property. /// [Category("Appearance")] public Image Image { get { return Button.Image; } set { Button.Image = value; } } /// /// Gets or sets the alignment of the image on the button control. /// Wraps the property. /// [DefaultValue(ContentAlignment.MiddleCenter)] [Category("Appearance")] public ContentAlignment ImageAlign { get { return Button.ImageAlign; } set { Button.ImageAlign = value; } } /// /// Gets or sets the alignment of the text on the button control. /// Wraps the property. /// [DefaultValue(ContentAlignment.MiddleLeft)] [Category("Appearance")] public virtual ContentAlignment TextAlign { get { return Button.TextAlign; } set { Button.TextAlign = value; } } /// /// Gets or sets the position of text and image relative to each other. /// Wraps the property. /// [DefaultValue(TextImageRelation.Overlay)] [Category("Appearance")] public TextImageRelation TextImageRelation { get { return Button.TextImageRelation; } set { Button.TextImageRelation = value; } } #endregion #region Protected Methods /// protected override object GetValue() { return null; } #endregion #region Public Methods /// public override void Serialize(FRWriter writer) { ButtonBaseControl c = writer.DiffObject as ButtonBaseControl; base.Serialize(writer); if (AutoSize != c.AutoSize) writer.WriteBool("AutoSize", AutoSize); if (!writer.AreEqual(Image, c.Image)) writer.WriteValue("Image", Image); if (ImageAlign != c.ImageAlign) writer.WriteValue("ImageAlign", ImageAlign); if (TextAlign != c.TextAlign) writer.WriteValue("TextAlign", TextAlign); if (TextImageRelation != c.TextImageRelation) writer.WriteValue("TextImageRelation", TextImageRelation); } #endregion } }