mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-07 07:26:05 +12:00
Allow drag n drop file to actions toolbar for uploading
This commit is contained in:
parent
3b8251617f
commit
3b92d5008b
|
@ -65,6 +65,7 @@ private void InitializeComponent()
|
|||
{
|
||||
SuspendLayout();
|
||||
|
||||
AllowDrop = true;
|
||||
AutoScaleDimensions = new SizeF(6F, 13F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
AutoSize = true;
|
||||
|
@ -78,8 +79,10 @@ private void InitializeComponent()
|
|||
Text = "ShareX - Actions toolbar";
|
||||
TopMost = Program.Settings.ActionsToolbarStayTopMost;
|
||||
|
||||
LocationChanged += SimpleActionsForm_LocationChanged;
|
||||
Shown += SimpleActionsForm_Shown;
|
||||
Shown += ActionsToolbarForm_Shown;
|
||||
LocationChanged += ActionsToolbarForm_LocationChanged;
|
||||
DragEnter += ActionsToolbarForm_DragEnter;
|
||||
DragDrop += ActionsToolbarForm_DragDrop;
|
||||
|
||||
tsMain = new ToolStripEx()
|
||||
{
|
||||
|
@ -164,16 +167,35 @@ private void InitializeComponent()
|
|||
UpdatePosition();
|
||||
}
|
||||
|
||||
private void SimpleActionsForm_Shown(object sender, EventArgs e)
|
||||
private void ActionsToolbarForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
this.ForceActivate();
|
||||
}
|
||||
|
||||
private void SimpleActionsForm_LocationChanged(object sender, EventArgs e)
|
||||
private void ActionsToolbarForm_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
CheckToolbarPosition();
|
||||
}
|
||||
|
||||
private void ActionsToolbarForm_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop, false) ||
|
||||
e.Data.GetDataPresent(DataFormats.Bitmap, false) ||
|
||||
e.Data.GetDataPresent(DataFormats.Text, false))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void ActionsToolbarForm_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
UploadManager.DragDropUpload(e.Data);
|
||||
}
|
||||
|
||||
private void CheckToolbarPosition()
|
||||
{
|
||||
Rectangle rectToolbar = Bounds;
|
||||
|
|
Loading…
Reference in a new issue