简体   繁体   中英

Listview Focus Issues with Remote Desktop in C#

I am dealing with a problem reported in my company's scheduling application written in C#. We have a list of events in a Listview on the right of the scheduling grid, and you can scroll through that list and drag and drop events onto the grid. This works great in XP, Vista, 7, etc -- but not when you're using remote desktop. When using remote desktop, you have to double-click the event so you can drag it onto the grid, even though the RD and the application have focus, as well as the Listview.

My boss told me that remote desktop just doesn't work well for a drag and drop operation, but I haven't really been able to find any proof of that. I've tried a variety of ways to solve this problem, including resetting the focus &/or selections, adding an extra call to the click event, and nothing has worked. I have DragLeave, MouseMove, MouseDown, and MouseUp events to play around with. The code does register the MouseMoves just fine... it just seems to swallow that first click. Has anyone experienced anything like this? Any ideas?

Have you checked that the control loses focus when using it remotely ?

Did you try something like the code below ?

public override void OnMouseEnter(MouseEventArgs e)
{
    this.Focus();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM