XY coordinates on form

G

Guest

I created a demo program with a status bar & status bar label on the form.
When the program runs, it's maximized. When I move the mouse over the form, I
can see the X & Y coordinates changing on the status bar label. Here's the
problem. I have a 19" LCD monitor with a resolution of 1280 by 1024. When the
program runs & the mouse is in the upper-left corner, the X & Y coordinates
are 0,0. When the mouse is in the lower-right corner, the X & Y coordinates
are 1279,941. OK, if someone installs this program (I know that it really
doesn't do anything.) on his computer & he has, say, a 17" CRT monitor with a
resolution of 800 by 600, will the resolution on the form still be 1279 by
941 or will it be 800 by 600? I want to be able to do graphics programs like
fractals & stuff & I want the resolution on the form to be independent of the
monitor size. Is that possible? Thank you.
 
T

tomb

pcnerd said:
I created a demo program with a status bar & status bar label on the form.
When the program runs, it's maximized. When I move the mouse over the form, I
can see the X & Y coordinates changing on the status bar label. Here's the
problem. I have a 19" LCD monitor with a resolution of 1280 by 1024. When the
program runs & the mouse is in the upper-left corner, the X & Y coordinates
are 0,0. When the mouse is in the lower-right corner, the X & Y coordinates
are 1279,941. OK, if someone installs this program (I know that it really
doesn't do anything.) on his computer & he has, say, a 17" CRT monitor with a
resolution of 800 by 600, will the resolution on the form still be 1279 by
941 or will it be 800 by 600? I want to be able to do graphics programs like
fractals & stuff & I want the resolution on the form to be independent of the
monitor size. Is that possible? Thank you.
You can change your own resolution and test it.

T
 
G

Guest

As I previously stated, I have an LCD monitor. If I changed the resolution,
everything would be fuzzy. Is there another way to test it?
 
G

Guest

As I previously stated, I have an LCD monitor. If I change the resolution,
everything will be fuzzy. Is there another way to test it?
 
G

Guest

As I previously stated, I have an LCD monitor. If I change the resolution,
everything will get fuzzy. Is there any other way to test it?
 
C

Chris Dunaway

pcnerd said:
As I previously stated, I have an LCD monitor. If I change the resolution,
everything will get fuzzy. Is there any other way to test it?

If the program is maximized, it should be displayed as the resolution
of the system on which it is running.

You can check the Screen.PrimaryScreen property to get the primary
display screen. Or you can use Screen.AllScreens to get all the screens
in an array.
 
G

Guest

If the program is maximized, it should be displayed as the resolution
of the system on which it is running.

That's what I thought. I had a 17" CRT monitor & I played around with
classic VB graphics. I figured that the XY coordinates on a form are
independent of the resolution & you confirmed it. It doesn't matter what the
screen size or resolution are. That's a good thing to know. Thank you.
 
G

Guest

JUst trying to understand you correctly. Do you mean that on your 17"
monitor that if you change the screen resolution to 800 x 600, the mouse X,Y
in the lower right hand corner still shows 1279, 941?
 
G

Guest

No, I set my 17" CRT monitor to a resolution of 800 by 600.

Last year, I got a new PC & a new 19" LCD monitor. My 19" LCD monitor has a
resolution of 1280 by 1024.

When I run the program on my 19" monitor, the form is maximized. The X & Y
coordinates at the upper-left are 0,0. At the lower-right, they are 1279,941.

It makes sense that the resolution on the form is independent of the size of
the monitor. I guess that VB adjusts the resolution of the form to correspond
to the resolution of the monitor. If I had to create a different program to
run on every conceivable monitor size & resolution, I'd go crazy. Thank you.
 
C

C-Services Holland b.v.

pcnerd said:
No, I set my 17" CRT monitor to a resolution of 800 by 600.

Last year, I got a new PC & a new 19" LCD monitor. My 19" LCD monitor has a
resolution of 1280 by 1024.

When I run the program on my 19" monitor, the form is maximized. The X & Y
coordinates at the upper-left are 0,0. At the lower-right, they are 1279,941.

It makes sense that the resolution on the form is independent of the size of
the monitor. I guess that VB adjusts the resolution of the form to correspond
to the resolution of the monitor. If I had to create a different program to
run on every conceivable monitor size & resolution, I'd go crazy. Thank you.

:

The size of a monitor doesn't really say much about the resolution your
desktop is set to (i.e. my 19" is running in 1600x1200). also remember
that the 1279,941 is variable even on a 1280x1024 resolution. If a user
increases the size of his taskbar the 941 will change. If he sets it to
autohide it will change. If he moves the taskbar to the side it will
change as will the 1279 value.

My point: detect how much space you have available at runtime and don't
assume anything about an endusers resolution while programming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top