All I'm looking for is a simple answer to a simple question

G

Guest

I originally asked this question in the "classic" VB forum. It occured to me
after I had sent it that I sent it to the wrong forum.

Anyway!

Here's the situation. I have VB.NET 2005 Express Edition. I have a 19" LCD
monitor with the resolution set at 1280 by 1024. I want to create a graphics
program, say, displaying fractals that will run with the form maximized. Are
the XY coordinates on the form independent of the size & resolution of the
monitor? I posted a question in this same newsgroup, & the person stated
that it's necessary in the code to determine the resolution of the monitor. Is
that really necessary? How do I do that? I don't want to have to create a
program for each & every monitor size & resolution! I would think that it
doesn't matter what size or resolution a monitor has. So, bottom line - my
monitor is set at 1280 by 1024. If someone with a 17" CRT monitor with a
resolution of 800 by 600 installs the program, will there be a problem? Thank
you.

I got 2 replies in the "Classic" VB forum.

Here is the first:
But... The X and Y coordinates won't change, just the amount of screen space
available (height and width). A pixel is a pixel regardless of how many
inches you have. You'll have to interrogate the Graphics object at run time
to see how much space you have to draw on.

Here is the second:
The resolution is the only thing that matters; the monitor size does
not. Things will work the same on a 15" monitor at 1024x768 as they
will on a 21" monitor at 1024x768.

So, you can see my confusion! How do I interrogate the Graphics object? Why
do I have to interrogate the Graphics object? Do I have to code the program
for a specific resolution? Which is the correct answer - the first reply or
the second?

Things were so much simpler in "classic" VB!

Thank you.

David
 
C

Charlie Brown

Actually a lot of things are much easier in dotnet.

The point I believe that needs to be made is that 0,0 will always be in
the top left corner of your screen. If you have an 800x800 res, than a
graphic (fractal) that is centered by using the origin of the screen
(0,0) and adding x and y values may not be centered on a larger
resolution. Think of resolutions as boxes that start at 0,0 and extend
x and y amount of pixels.

As for vb.net here is the code to get the screen res

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/7caf73f64eaf4382

Now if you create a windows form application and set the form to
maximize and your fractal is centered on the form it will not matter
which resolution you use.
 
G

gene kelley

I originally asked this question in the "classic" VB forum. It occured to me
after I had sent it that I sent it to the wrong forum.

Anyway!

Here's the situation. I have VB.NET 2005 Express Edition. I have a 19" LCD
monitor with the resolution set at 1280 by 1024. I want to create a graphics
program, say, displaying fractals that will run with the form maximized. Are
the XY coordinates on the form independent of the size & resolution of the
monitor? I posted a question in this same newsgroup, & the person stated
that it's necessary in the code to determine the resolution of the monitor. Is
that really necessary? How do I do that? I don't want to have to create a
program for each & every monitor size & resolution! I would think that it
doesn't matter what size or resolution a monitor has. So, bottom line - my
monitor is set at 1280 by 1024. If someone with a 17" CRT monitor with a
resolution of 800 by 600 installs the program, will there be a problem? Thank
you.

I got 2 replies in the "Classic" VB forum.

Here is the first:
But... The X and Y coordinates won't change, just the amount of screen space
available (height and width). A pixel is a pixel regardless of how many
inches you have. You'll have to interrogate the Graphics object at run time
to see how much space you have to draw on.

Here is the second:
The resolution is the only thing that matters; the monitor size does
not. Things will work the same on a 15" monitor at 1024x768 as they
will on a 21" monitor at 1024x768.

So, you can see my confusion! How do I interrogate the Graphics object? Why
do I have to interrogate the Graphics object? Do I have to code the program
for a specific resolution? Which is the correct answer - the first reply or
the second?

Things were so much simpler in "classic" VB!

This generic question and the answer are the same in any programming
envionment.

Assume a given form that contains an 800 x 600 image in a picture box.
In any size of monitor that is set at 1280 x 1024, the displayed form
will be the same. In any size monitor that is set to 800 x 600, a
portion ot the right and bottom of the picture will not be visible
unless form scrolling has been implemented.

Assume the above, but with the picture in a scrollable child form. If
the main form's layout was designed to accomodate 800 x 600, then the
user's resolution setting is a non-issue.

A common practice is to design an app around a minimum supported
screen resolution meaning if 1024 x 768 is to be the minimum supported
size, then the app will not run on an 800 x 600 system.


Gene
 
G

Guest

One easy way to draw your fractals on any screen resolution is to pick a
nominal resolution then in all drawing routines where you input x,y, use
fx(nominalxvalue) and fy(nominalyvalue). In you functions fx and fy, you can
convert the nominalxvalue and nominalyvalue to the proper x,y values
depending on the screen resolution that is currently running. Hope this
helps.
 
L

Larry Lard

pcnerd said:
I originally asked this question in the "classic" VB forum. It occured to me
after I had sent it that I sent it to the wrong forum.

Anyway!

Here's the situation. I have VB.NET 2005 Express Edition. I have a 19" LCD
monitor with the resolution set at 1280 by 1024. I want to create a graphics
program, say, displaying fractals that will run with the form maximized. Are
the XY coordinates on the form independent of the size & resolution of the
monitor? I posted a question in this same newsgroup, & the person stated
that it's necessary in the code to determine the resolution of the monitor. Is
that really necessary?

Well, different screen resolutions mean different numbers of pixels,
so, yes. Note there is a difference between the monitor and the screen
- the monitor is the physical object, the screen is what programs draw
on. A *monitor* doesn't really have a resolution (LCD monitors have a
'native resolution' but that doesn't mean the screen they display has
to have that resolution).
How do I do that? I don't want to have to create a
program for each & every monitor size & resolution! I would think that it
doesn't matter what size or resolution a monitor has. So, bottom line - my
monitor is set at 1280 by 1024. If someone with a 17" CRT monitor with a
resolution of 800 by 600 installs the program, will there be a problem? Thank
you.

What happens if you draw a 1000 pixel x 1000 pixel box on a 1280x1024
screen? On a 800x600 screen? Different results, right? That's why it
matters.
I got 2 replies in the "Classic" VB forum.

Here is the first:
But... The X and Y coordinates won't change, just the amount of screen space
available (height and width). A pixel is a pixel regardless of how many
inches you have. You'll have to interrogate the Graphics object at run time
to see how much space you have to draw on.

Right idea, wrong object.
Here is the second:
The resolution is the only thing that matters; the monitor size does
not. Things will work the same on a 15" monitor at 1024x768 as they
will on a 21" monitor at 1024x768.

True but misleading (although your question wasn't the clearest)
So, you can see my confusion! How do I interrogate the Graphics object? Why
do I have to interrogate the Graphics object? Do I have to code the program
for a specific resolution? Which is the correct answer - the first reply or
the second?

You havae to find out what the current screen resolution is. You can't
just say "I want to draw a box as big as the screen" - you have to say
how many *pixels* big you want your box to be.

It's in fact really simple to find out the resolution of the screen:

Dim screenRect As Rectangle = Screen.PrimaryScreen.Bounds
Things were so much simpler in "classic" VB!

How would things have been different in vb6? You can't magically say
'as big as the screen' there either - you would have to interrogate
Screen.Height and Screen.Width, *and* convert from twips to pixels.
 

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