Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.

Her is a horse of a different problem. (VB6)

I have a form that the user can opt to snap to the left edge if the screen if desired.
This for can also span across monitors if desired or be confined to just one of many screens in an extended desktop arrangement.

I would like to allow the user to left edge snap the form to the particular monitor the form is currently running on. Right now if the form is running on any of the monitors after having been dragged there, and the left snap is enabled, it will left snap to monitor 0, and I want it to left snap to the monitor it is currently running on. I currently just set the form's .Left to 0. How would I detect an accurate "Left 0" offset of where my form is currently running? The potential user base is "multi screen happy" so the form could find itself running on one of many monitors.

And don't want to reinvent the wheel.

Thanks,

:Ron
Posted

1 solution

You have to first detect how many monitors there are, and in what orientation. If monitor 1 is on the right side, monitor2's X coordinates will all be negative. If monitor 2 is on the right, all X coords with be higher than monitor1's resolution.

Once you've done that, snapping to the appropriate edge is easy.
 
Share this answer
 
Comments
Ron Anders 17-Aug-11 9:04am    
Thanks.

That part I know, I don't know how to enumerate the monitors and their arrangement. Windows knows but not me. :-). A larger issue I imagine would be the form knowing where it is running, no?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900