ButtonControl.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.ComponentModel;
  2. using FastReport.Utils;
  3. using System.Windows.Forms;
  4. using System.Drawing;
  5. namespace FastReport.Dialog
  6. {
  7. /// <summary>
  8. /// Represents a Windows button control.
  9. /// Wraps the <see cref="System.Windows.Forms.Button"/> control.
  10. /// </summary>
  11. public partial class ButtonControl : ButtonBaseControl
  12. {
  13. private Button button;
  14. #region Properties
  15. /// <summary>
  16. /// Gets an internal <b>Button</b>.
  17. /// </summary>
  18. [Browsable(false)]
  19. public Button Button
  20. {
  21. get { return button; }
  22. }
  23. /// <summary>
  24. /// Gets or sets a value that is returned to the parent form when the button is clicked.
  25. /// Wraps the <see cref="System.Windows.Forms.Button.DialogResult"/> property.
  26. /// </summary>
  27. [DefaultValue(DialogResult.None)]
  28. [Category("Behavior")]
  29. public DialogResult DialogResult
  30. {
  31. get { return Button.DialogResult; }
  32. set { Button.DialogResult = value; }
  33. }
  34. #endregion
  35. #region Public Methods
  36. /// <inheritdoc/>
  37. public override void Serialize(FRWriter writer)
  38. {
  39. ButtonControl c = writer.DiffObject as ButtonControl;
  40. base.Serialize(writer);
  41. if (DialogResult != c.DialogResult)
  42. writer.WriteValue("DialogResult", DialogResult);
  43. }
  44. #endregion
  45. /// <summary>
  46. /// Initializes a new instance of the <b>ButtonControl</b> class with default settings.
  47. /// </summary>
  48. public ButtonControl()
  49. {
  50. button = new Button();
  51. Control = button;
  52. }
  53. }
  54. }