|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
All I'm looking for is a simple answer to a simple questionafter 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 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. pcnerd wrote: Show quoteHide quote > 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 On Wed, 7 Jun 2006 07:47:02 -0700, pcnerd
<pcn***@discussions.microsoft.com> wrote: Show quoteHide quote >I originally asked this question in the "classic" VB forum. It occured to me This generic question and the answer are the same in any programming>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! > 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 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. -- Show quoteHide quoteDennis in Houston "pcnerd" wrote: > 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 > pcnerd wrote:
> I originally asked this question in the "classic" VB forum. It occured to me Well, different screen resolutions mean different numbers of pixels,> 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? 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 What happens if you draw a 1000 pixel x 1000 pixel box on a 1280x1024> 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. screen? On a 800x600 screen? Different results, right? That's why it matters. > Right idea, wrong object.> 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. > True but misleading (although your question wasn't the clearest)> 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 You havae to find out what the current screen resolution is. You can't> 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? 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. -- Larry Lard Replies to group please
How to Automatically Update UI When Data Changes
HelpCursor on ToolStripMenuItem API Help in saving database DataGrid Control How do I use a class, when the class requires functions in the main form? Object-to-Relational Tool Error while file copying over network. Process.start explorer in popup Shell IE ? |
|||||||||||||||||||||||