views:

59

answers:

1

We have an application that runs on XP64 and Vista64 multiple monitor workstations, and have a strange problem when a single form in the application is moved to certain monitors.

If the form is moved to a monitor that is to the left and above the primary monitor (it has negative coordinates in the Display Settings dialog), the users will get a diagonal resize cursor when putting the cursor in the form (I have only seen it happen when the cursor is in the window's chrome, but users have reported it happening inside the whole window).

I was able to determine that it only happens when the cursor is above the primary monitor (making the secondary monitor only partially above the primary monitor results in the problem occurring only in the part of the form that is above the primary monitor).

This only happens with one form in our entire application, and this one doesn't do anything especially fancy (doesn't override WndProc, etc.) and all the custom controls used are also used in other forms that don't display this problem.

What would cause the diagonal resize cursor to show up all the time?

+1  A: 

This appears to be a bug in Form.WmNCHitTest. I believe the way that it is determining the x and y coordinates are incorrect (to get the y it does HIWORD((int)((long)lParam)), where the documentation says to use GET_Y_LPARAM which is defined as ((int)(short)HIWORD(lParam))).

It only uses this method if you have the size grip turned on. Turning off the size grip bypasses this code and makes the form work properly.

Adam Hughes