Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a C# Form to a Negative Location

I am working on a tool for Windows that will interface with CloudApp using its API. I found some articles on here about how to achieve the Region capture which I used to modified to fit my exact needs. Everything is going very well, but I am having trouble with a multi-monitor setup. The reason for the trouble, is that I run one monitor in 1920x1080 and the second is 1080x1920.

The overall flow is that I create an image of the entire screen (3000, 1920), then I show it as the background in a form. The issue is I can't get that form to start at a negative point so it moves everything down.

If I look at the raw image I capture before I do the region selection, all is well:

http://img.paronity.com/KsiA

enter image description here

The issue is when I go to bring up the region form. In order for it to be the background of the form and be in the correct place, I would need the form's upper left X,Y to be (0,-670). No matter which method I try, I am unable to achieve this.

Is there any way to achieve the negative point that I am missing? For sake of being complete, I made a very simple form which outputs its "top" coordinate when you move it, and when I move it to the upper portion of the vertical monitor, I get negative points for it so I know they are valid.

Let me know if any part of my code would be helpful and I will post it. I just wasn't sure it was going to be necessary. Thanks in advance!

like image 235
Paronity Avatar asked Nov 14 '12 03:11

Paronity


1 Answers

Sorry for the post. It is possible to do. The issue was that I was setting the size of the form in the constructor for the form. I wasn't aware this wouldn't work. Once I set it on the form load event instead, it moved it into the right place.

Thanks @dognose! You saying your test worked made me think that is was probably a scope/placement issue and it was! Thanks for everyone looking at this question!

like image 74
Paronity Avatar answered Oct 12 '22 01:10

Paronity