From 9995bfc0eb7e254bc514237c2a2e52138b72074c Mon Sep 17 00:00:00 2001 From: Ahmet Sait Date: Wed, 17 Apr 2024 21:07:02 +0300 Subject: [PATCH] Add `_ScintillaManagedDragDrop` for making `RevokeDragDrop()` optional --- Shared/Scintilla.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Shared/Scintilla.cs b/Shared/Scintilla.cs index ab77780..f83fd1e 100644 --- a/Shared/Scintilla.cs +++ b/Shared/Scintilla.cs @@ -1818,7 +1818,8 @@ protected override unsafe void OnHandleCreated(EventArgs e) // ways to solve this, but my favorite is to revoke drag and drop from the // native Scintilla control before base.OnHandleCreated does the standard // processing of AllowDrop. - NativeMethods.RevokeDragDrop(Handle); + if (!this._ScintillaManagedDragDrop) + NativeMethods.RevokeDragDrop(this.Handle); base.OnHandleCreated(e); } @@ -3276,6 +3277,18 @@ public unsafe void ClearRepresentation(string encodedString) #region Properties + /// + /// Gets or sets whether Scintilla's native drag & drop should be used instead of WinForms based one. + /// + /// true if Scintilla's native drag & drop should be used; otherwise, false. The default is false. + [DefaultValue(false)] + [Category("Behaviour")] + [Description("Indicates whether Scintilla's native drag & drop should be used instead of WinForms based one.")] + public bool _ScintillaManagedDragDrop { get; set; } + // Underscore is used so that WinForms Designer sets it before any other + // property. Otherwise ApplyResources gets called on the control before + // the property is set, which then triggers OnHandleCreated before we + // have the final value. /// /// Gets or sets the bi-directionality of the Scintilla control.