DialogComponentBase.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Drawing;
  2. using System.ComponentModel;
  3. namespace FastReport.Dialog
  4. {
  5. /// <summary>
  6. /// Base class for all dialog components.
  7. /// </summary>
  8. public abstract partial class DialogComponentBase : ComponentBase
  9. {
  10. #region Properties
  11. /// <summary>
  12. /// Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.
  13. /// </summary>
  14. [Category("Layout")]
  15. public Point Location
  16. {
  17. get { return new Point((int)Left, (int)Top); }
  18. set
  19. {
  20. Left = value.X;
  21. Top = value.Y;
  22. }
  23. }
  24. /// <summary>
  25. /// Gets or sets the height and width of the control.
  26. /// </summary>
  27. [Category("Layout")]
  28. public Size Size
  29. {
  30. get { return new Size((int)Width, (int)Height); }
  31. set
  32. {
  33. Width = value.Width;
  34. Height = value.Height;
  35. }
  36. }
  37. #endregion
  38. #region Public Methods
  39. /// <inheritdoc/>
  40. public override void Assign(Base source)
  41. {
  42. BaseAssign(source);
  43. }
  44. #endregion
  45. /// <summary>
  46. /// Initializes a new instance of the <b>DialogComponentBase</b> class with default settings.
  47. /// </summary>
  48. public DialogComponentBase()
  49. {
  50. if (BaseName.EndsWith("Component"))
  51. BaseName = ClassName.Remove(ClassName.IndexOf("Component"));
  52. if (BaseName.EndsWith("Control"))
  53. BaseName = ClassName.Remove(ClassName.IndexOf("Control"));
  54. }
  55. }
  56. }