You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using FastColoredTextbox, I'm not able to make the DragDrop or DragEnter or DragOver events work. Basically, when I put in some code inside the Events nothing changes, I've looked all over the internet to try making drag and drop work however it still does not.
Any solutions or any way this can be fixed for FastColoredTextbox?
The text was updated successfully, but these errors were encountered:
Make sure you are Not running your IDE as Admin (assuming Visual Studio here).
Below is a working example. The FastColoredTextBox is named SqlCmdWindow.
private void SqlCmdWindow_DragOver(object sender, DragEventArgs e)
{
// Check if the format of the data can be accepted
// Only accept file drops from Explorer, etc.
var ccx = StringComparison.InvariantCultureIgnoreCase;
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
var filePath = files.FirstOrDefault();
if (filePath != null && (filePath.EndsWith(".sql", ccx) || filePath.EndsWith(".txt", ccx)))
e.Effect = DragDropEffects.Link;
else
e.Effect = DragDropEffects.None;
}
private void SqlCmdWindow_DragDrop(object sender, DragEventArgs e)
{
// Extract the data from the DataObject-Container into a string list
var ccx = StringComparison.InvariantCultureIgnoreCase;
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
var filePath = files.FirstOrDefault();
if (filePath != null && (filePath.EndsWith(".sql", ccx) || filePath.EndsWith(".txt", ccx)))
{
TitleMsg.Text = filePath;
var fileText = File.ReadAllText(filePath);
// Add file text into FastColoredTextBox control:
SqlCmdWindow.Text = fileText;
}
}
When using FastColoredTextbox, I'm not able to make the DragDrop or DragEnter or DragOver events work. Basically, when I put in some code inside the Events nothing changes, I've looked all over the internet to try making drag and drop work however it still does not.
Any solutions or any way this can be fixed for FastColoredTextbox?
The text was updated successfully, but these errors were encountered: