[英]Keep the cursor at default shape during drag and drop operation in windows forms c#
I am doing a simple drag and drop operation in windows forms.我正在 Windows 窗体中进行简单的拖放操作。 Whenever I start the operation the cursor changes shape.每当我开始操作时,光标都会改变形状。 I know this is directly related to the DragDropEffects
and I can't find an option that results in the default cursor.我知道这与DragDropEffects
直接相关,我找不到导致默认光标的选项。 Can anybody help?有人可以帮忙吗? Here is the code:这是代码:
a.MouseDown += new MouseEventHandler(ButtonDown);
a.DragEnter += new DragEventHandler(ButtonDragEnter);
a.AllowDrop = true;
and here are the functions:以下是功能:
private void ButtonDown(object sender, EventArgs e)
{
PictureBox p = (PictureBox)sender;
ButtonClick(sender, e);
p.DoDragDrop(p.BackColor, DragDropEffects.All);
}
private void ButtonDragEnter(object sender, DragEventArgs e)
{
e.Data.GetFormats();
e.Effect = DragDropEffects.None;
Color c = new Color();
c = (Color) e.Data.GetData(c.GetType());
ButtonClick(sender, e,c);
}
Ok answered my own question here:好的在这里回答了我自己的问题:
You first need to add an event to giveFeedBack:您首先需要添加一个事件来 giveFeedBack:
a.GiveFeedback += new GiveFeedbackEventHandler(DragSource_GiveFeedback);
and here is the feedback function:这是反馈功能:
private void DragSource_GiveFeedback(object sender, GiveFeedbackEventArgs e)
{
e.UseDefaultCursors = false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.