PictureObject.DesignExt.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using FastReport.Forms;
  2. using FastReport.Utils;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. namespace FastReport
  6. {
  7. partial class PictureObject : IHasEditor
  8. {
  9. #region Private Methods
  10. private bool ShouldSerializeImage()
  11. {
  12. return Image != null;
  13. }
  14. private bool ShouldSerializePadding()
  15. {
  16. return Padding != new System.Windows.Forms.Padding();
  17. }
  18. private bool ShouldSerializeTransparentColor()
  19. {
  20. return TransparentColor != Color.Transparent;
  21. }
  22. #endregion Private Methods
  23. #region Public Methods
  24. /// <inheritdoc/>
  25. public override void HandleDragDrop(FRMouseEventArgs e)
  26. {
  27. PictureObject dragSource = e.DragSource as PictureObject;
  28. if (dragSource != null)
  29. {
  30. if (dragSource.Image != null) // drag from OS
  31. Image = dragSource.Image;
  32. else // drag from DictionaryWindow
  33. {
  34. DataColumn = dragSource.DataColumn;
  35. if (Image != null)
  36. {
  37. Image.Dispose();
  38. Image = null;
  39. }
  40. }
  41. }
  42. dragAccept = false;
  43. }
  44. /// <inheritdoc/>
  45. public override void HandleDragOver(FRMouseEventArgs e)
  46. {
  47. if (PointInObject(new PointF(e.x, e.y)) && e.DragSource is PictureObject)
  48. e.handled = true;
  49. dragAccept = e.handled;
  50. }
  51. /// <summary>
  52. /// Invokes the object's editor.
  53. /// </summary>
  54. /// <returns><b>true</b> if object was edited succesfully.</returns>
  55. public override bool InvokeEditor()
  56. {
  57. using (PictureEditorForm form = new PictureEditorForm(this))
  58. {
  59. return form.ShowDialog() == DialogResult.OK;
  60. }
  61. }
  62. #endregion Public Methods
  63. }
  64. }