Setting a C# Form to a Negative Location
Asked Answered
S

1

6

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!

Spoilage answered 14/11, 2012 at 3:32 Comment(3)
Windows Forms, WPF, SilverLight?Luann
if i use this.Location = new Point(-50, -50); in a form, it works as expected?Zinfandel
I tried with a winform, set the StartPosition to "Manual" and set the location to 0; -670 it works as expectedRyanryann
S
2

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!

Spoilage answered 14/11, 2012 at 15:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.