PanelControl.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System.Windows.Forms;
  2. using System.Drawing;
  3. using System.ComponentModel;
  4. using System.Drawing.Drawing2D;
  5. using FastReport.Utils;
  6. namespace FastReport.Dialog
  7. {
  8. /// <summary>
  9. /// Used to group collections of controls.
  10. /// Wraps the <see cref="System.Windows.Forms.Panel"/> control.
  11. /// </summary>
  12. public partial class PanelControl : ParentControl
  13. {
  14. private Panel panel;
  15. #region Properties
  16. /// <summary>
  17. /// Gets an internal <b>Panel</b>.
  18. /// </summary>
  19. [Browsable(false)]
  20. public Panel Panel
  21. {
  22. get { return panel; }
  23. }
  24. /// <summary>
  25. /// Indicates the border style for the control.
  26. /// Wraps the <see cref="System.Windows.Forms.Panel.BorderStyle"/> property.
  27. /// </summary>
  28. [DefaultValue(BorderStyle.None)]
  29. [Category("Appearance")]
  30. public BorderStyle BorderStyle
  31. {
  32. get { return Panel.BorderStyle; }
  33. set { Panel.BorderStyle = value; }
  34. }
  35. #endregion
  36. /// <inheritdoc/>
  37. public override void Draw(FRPaintEventArgs e)
  38. {
  39. base.Draw(e);
  40. Pen pen = e.Cache.GetPen(Color.Gray, 1, DashStyle.Dash);
  41. e.Graphics.DrawRectangle(pen, AbsLeft, AbsTop, Width - 1, Height - 1);
  42. }
  43. #region Public Methods
  44. /// <inheritdoc/>
  45. public override void Serialize(FRWriter writer)
  46. {
  47. PanelControl c = writer.DiffObject as PanelControl;
  48. base.Serialize(writer);
  49. if (BorderStyle != c.BorderStyle)
  50. writer.WriteValue("BorderStyle", BorderStyle);
  51. }
  52. #endregion
  53. /// <summary>
  54. /// Initializes a new instance of the <b>PanelControl</b> class with default settings.
  55. /// </summary>
  56. public PanelControl()
  57. {
  58. panel = new Panel();
  59. Control = panel;
  60. }
  61. }
  62. }