捕获RichTextBox的DragDrop事件C# [英] Capture DragDrop Event of RichTextBox C#

查看:196
本文介绍了捕获RichTextBox的DragDrop事件C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的RichTextBox控件,从Windows提供的RichTextBox控件。

I have a custom RichTextBox Control derived from RichTextBox Control that Windows provides.

我无法捕获dragDrop事件,尽管DragEnter事件被捕获,但我不知道为什么dragDrop事件不是。

I am unable to capture the dragDrop Event though the DragEnter event is getting captured, but I dont know why the dragDrop event is not.

我有以下属性设置为true:

I have following properties set as true:

EnableAutoDragDrop=true;
AllowDrop=true;

我缺少什么?

推荐答案

Daniel在这里可能是正确的:

Daniel is probably correct here:

    private void DragOver(object sender, System.Windows.Forms.DragEventArgs e) 
    {
        if (!e.Data.GetDataPresent(typeof(System.String))) {

            e.Effect = DragDropEffects.None;
            DropLocationLabel.Text = "None - no string data.";
            return;
        }

另见以下示例:

http://msdn.microsoft.com/en-us/library /system.windows.forms.control.dodragdrop.aspx

这篇关于捕获RichTextBox的DragDrop事件C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆