using System.ComponentModel; using System.Windows.Forms; using System.Drawing; using FastReport.Utils; using System.Drawing.Drawing2D; namespace FastReport.Dialog { /// /// Represents a Windows picture box control for displaying an image. /// Wraps the control. /// public partial class PictureBoxControl : DialogControl { private PictureBox pictureBox; #region Properties /// /// Gets an internal PictureBox. /// [Browsable(false)] public PictureBox PictureBox { get { return pictureBox; } } /// /// Indicates the border style for the control. /// Wraps the property. /// [DefaultValue(BorderStyle.None)] [Category("Appearance")] public BorderStyle BorderStyle { get { return PictureBox.BorderStyle; } set { PictureBox.BorderStyle = value; } } /// /// Gets or sets the image that the PictureBox displays. /// Wraps the property. /// [Category("Appearance")] public Image Image { get { return PictureBox.Image; } set { PictureBox.Image = value; } } /// /// Indicates how the image is displayed. /// Wraps the property. /// [DefaultValue(PictureBoxSizeMode.Normal)] [Category("Behavior")] public PictureBoxSizeMode SizeMode { get { return PictureBox.SizeMode; } set { PictureBox.SizeMode = value; } } #endregion #region Public Methods /// public override void Serialize(FRWriter writer) { PictureBoxControl c = writer.DiffObject as PictureBoxControl; base.Serialize(writer); if (BorderStyle != c.BorderStyle) writer.WriteValue("BorderStyle", BorderStyle); if (!writer.AreEqual(Image, c.Image)) writer.WriteValue("Image", Image); if (SizeMode != c.SizeMode) writer.WriteValue("SizeMode", SizeMode); } public override void Draw(FRPaintEventArgs e) { base.Draw(e); Pen pen = e.Cache.GetPen(Color.Gray, 1, DashStyle.Dash); e.Graphics.DrawRectangle(pen, AbsLeft, AbsTop, Width - 1, Height - 1); } #endregion /// /// Initializes a new instance of the PictureBoxControl class with default settings. /// public PictureBoxControl() { pictureBox = new PictureBox(); Control = pictureBox; } } }