在wpf中拖放 [英] drag and drop in wpf

查看:90
本文介绍了在wpf中拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在wpf的窗口中有椭圆或任何形状如何将它拖放到窗口中的画布上?

Hi,I have ellipse in the window in wpf or any shape how can drag and drop it to the canvas in the window?

private void ellipse_MouseMove(object sender, MouseEventArgs e)
{
    Ellipse ellipse = sender as Ellipse;
    if (ellipse != null && e.LeftButton == MouseButtonState.Pressed)
    {
        DragDrop.DoDragDrop( ellipse,
                             ellipse.Fill.ToString(),
                             DragDropEffects.Copy);
    }
}

推荐答案

您已从 MSDN文档 [ ^ ]。从那里读更多东西是否令人头痛?那只是第一页,继续在MSDN上阅读更多内容,你将从那里学习drap并从中获取WPF。



由于该代码不是你的,你不会是能够理解我们可能作为解决方案或建议共享的任何其他代码。我会建议你继续阅读这些文件并试用他们的代码。 MSDN代码仅供参考和试用。
You've copied the code sample from MSDN document[^]. Was it a headache reading more from there? That was just the first page, continue reading more on MSDN you will learn drap and drop in WPF from there.

Since that code is not yours, you will not be able to understand any other code that we might share as a solution or suggestion. I will suggest, you keep reading those documents and trying out their code. MSDN codes are for examples and trial sort of stuff.


这篇关于在wpf中拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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