如何在我的网页中获取鼠标事件Args [英] How to get Mouse Event Args in my web page

查看:77
本文介绍了如何在我的网页中获取鼠标事件Args的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



我有一页GridView。现在我想拖放行。我搜索并发现了一些文章,并且他们已经给了MouseEventArgs ...我没有在我的网页中获得这些Args。我是否需要在我的网页上添加任何东西才能获得MouseEventArgs?



Hello All,

I have one page with GridView. Now I wanted to drag and drop of rows. I have searched and found some articles and in that they have given MouseEventArgs... I am not getting those Args in my web page. Do I need to add any thing to get MouseEventArgs on my web page?.

private void dataGridView1_MouseMove(object sender, MouseEventArgs e)
{
    if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
    {
        // If the mouse moves outside the rectangle, start the drag.
        if (dragBoxFromMouseDown != Rectangle.Empty &&
            !dragBoxFromMouseDown.Contains(e.X, e.Y))
        {

            // Proceed with the drag and drop, passing in the list item.
            DragDropEffects dropEffect = dataGridView1.DoDragDrop(
                     dataGridView1.Rows[rowIndexFromMouseDown],
                     DragDropEffects.Move);
        }
    }
}





有任何建议请...



谢谢

Naveen。



Any suggestions please...

Thanks
Naveen.

推荐答案

MouseEventArgs无法正常工作的原因是它在表单中可用应用程序...

,因为你在网络应用程序中使用它,它会给你错误...



对于拖放行为Web应用程序,您可以使用JQuery,这里有一些链接...



http://csharpdotnetfreak.blogspot.com/2012/07/drag-drop-gridview-rows-jquery-aspnet.html [ ^ ]



http:// isocra .com / 2008/02 / table-drag-and-drop-jquery-plugin / [ ^ ]
The reason MouseEventArgs is not working is it is available in Forms application...
since you are using it in web application, it gives you error...

For drag and drop behavior in Web app, you can use JQuery and here are some links...

http://csharpdotnetfreak.blogspot.com/2012/07/drag-drop-gridview-rows-jquery-aspnet.html[^]

http://isocra.com/2008/02/table-drag-and-drop-jquery-plugin/[^]


这篇关于如何在我的网页中获取鼠标事件Args的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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