[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BeeJ

8/9/2012 5:30:00 PM

My VB6 app looks good on Win XP Pro but is distorted on Win 7.
I draw an icon into a Image Control (with Stretch set) OK on Win XP.
The icon fills the Image Control properly. I can even change the size
of the Image Control dynamically and the icon stretches properly.

On Win 7 (the same app) the icon is there but it is blown up about 20%
and it is like it is cut off on the right and bottom. Top, left is
correct.

I know Win 7 is doing this because it is related to a Personalize
setting\Display "Make It Easier to read what's on your screen".
When set to Smaller 100% Win 7 looks OK (icon properly fits and
stretches with the Image Control) but when set to say Medium 125% I get
the distortion. Seems strange that the icon in the Image Control
would expand and not obey the Stretch.

I need to use the Personalize setting\Display Medium or Larger settings
to make the screen readable for me.

So what is this all about and how can I rectify it?
Something like: Detect windows version, Detect the Personalize
Setting\Display then tweak the image? How do I do that? Or is it
something simpler?


12 Answers

unknown

8/9/2012 6:06:00 PM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:k00s2l$53u$1@dont-email.me...
> My VB6 app looks good on Win XP Pro but is distorted on Win 7.
> I draw an icon into a Image Control (with Stretch set) OK on Win XP. The
> icon fills the Image Control properly. I can even change the size of the
> Image Control dynamically and the icon stretches properly.
>
> On Win 7 (the same app) the icon is there but it is blown up about 20% and
> it is like it is cut off on the right and bottom. Top, left is correct.
>
> I know Win 7 is doing this because it is related to a Personalize
> setting\Display "Make It Easier to read what's on your screen".
> When set to Smaller 100% Win 7 looks OK (icon properly fits and stretches
> with the Image Control) but when set to say Medium 125% I get the
> distortion. Seems strange that the icon in the Image Control would
> expand and not obey the Stretch.
>
> I need to use the Personalize setting\Display Medium or Larger settings to
> make the screen readable for me.
>
> So what is this all about and how can I rectify it?
> Something like: Detect windows version, Detect the Personalize
> Setting\Display then tweak the image? How do I do that? Or is it
> something simpler?

Search the newsgroups for "Mike Williams dpi aware", and then use Find in
your browser and look for "BeeJ".


BeeJ

8/9/2012 7:59:00 PM

0

Farnsworth pretended :
> "BeeJ" <nospam@spamnot.com> wrote in message
> news:k00s2l$53u$1@dont-email.me...
>> My VB6 app looks good on Win XP Pro but is distorted on Win 7.
>> I draw an icon into a Image Control (with Stretch set) OK on Win XP. The
>> icon fills the Image Control properly. I can even change the size of the
>> Image Control dynamically and the icon stretches properly.
>>
>> On Win 7 (the same app) the icon is there but it is blown up about 20% and
>> it is like it is cut off on the right and bottom. Top, left is correct.
>>
>> I know Win 7 is doing this because it is related to a Personalize
>> setting\Display "Make It Easier to read what's on your screen".
>> When set to Smaller 100% Win 7 looks OK (icon properly fits and stretches
>> with the Image Control) but when set to say Medium 125% I get the
>> distortion. Seems strange that the icon in the Image Control would expand
>> and not obey the Stretch.
>>
>> I need to use the Personalize setting\Display Medium or Larger settings to
>> make the screen readable for me.
>>
>> So what is this all about and how can I rectify it?
>> Something like: Detect windows version, Detect the Personalize
>> Setting\Display then tweak the image? How do I do that? Or is it
>> something simpler?
>
> Search the newsgroups for "Mike Williams dpi aware", and then use Find in
> your browser and look for "BeeJ".

Where I am now, there is no reference to DPI. So this Small, Medium
and Larger is some choice of DPI and not something else?

I re-read the posts you mention and do not see where some control would
not respond correctly to stretch when the DPI or whatever it is I am
tweaking is changed.

My form contains a PictureBox. Inside the picturebox is the image
control. On Win7, not only does the Image control not stretch properly
(I am not sizing anything just letting the Image Control do its thing)
but the picturebox does not sit properly inside the form. The picture
box is sized by me to fill the form less a small border of the form
showing on all edges. The picturebox looks as if it is slid to the
right and down on Win 7 (Note: Win 7, DPI or whatever it is setting to
any value it does this. Only the Image stretch changes.), and is
correct on XP. There is no text, only the picturebox holding the image
control.

--
Present and unaccounted for.


Mike Williams

8/9/2012 9:11:00 PM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:k014pe$k7e$1@speranza.aioe.org...
>> Farnsworth pretended :
>> Search the newsgroups for "Mike Williams dpi aware", and then
>> use Find in your browser and look for "BeeJ".
>
> Where I am now, there is no reference to DPI. So this Small,
> Medium and Larger is some choice of DPI and not something else?

I think Farnsworth was referring to the fact that all this stuff has been
done before on the VB6 groups, often in great detail, and some of it has
been covered in threads in which you have yourself been involved, and so
there should be no need to go over it all again. For starters, have a look
at the following thread, a thread in which you were yourself involved:

https://groups.google.com/forum/?hl=en&f...!topic/alt.comp.lang.vb/jjPXuRAGYqI%5B1-25%5D

There are dozens of threads on the same subject, and the stuff in the above
thread is really just an outline of what the various dpi settings do and how
VB responds to them, together with a note about the new behaviour in Vista
and Win7 where at some settings the machine "tells lies" to your program
about what the dpi settings on that machine actually are, and how to prevent
it lying (using a dpiaware section in a manifest). Essentially you need to
declare your program as being "dpi aware" (doing it properly using a
manifest rather than using the SetProcessDPIAware API function which does
not work). You then need to make sure that your program is written in such a
way that it actually /is/ dpi aware.

> but the picturebox does not sit properly inside the form. The
> picture box is sized by me to fill the form less a small border
> of the form showing on all edges. The picturebox looks as if
> it is slid to the right and down on Win 7

Code. Show your code.

Mike





BeeJ

8/10/2012 2:08:00 AM

0

After serious thinking Mike Williams wrote :
> "BeeJ" <nospam@spamnot.com> wrote in message
> news:k014pe$k7e$1@speranza.aioe.org...
>>> Farnsworth pretended :
>>> Search the newsgroups for "Mike Williams dpi aware", and then
>>> use Find in your browser and look for "BeeJ".
>>
>> Where I am now, there is no reference to DPI. So this Small,
>> Medium and Larger is some choice of DPI and not something else?
>
> I think Farnsworth was referring to the fact that all this stuff has been
> done before on the VB6 groups, often in great detail, and some of it has been
> covered in threads in which you have yourself been involved, and so there
> should be no need to go over it all again. For starters, have a look at the
> following thread, a thread in which you were yourself involved:
>
>
> https://groups.google.com/forum/?hl=en&f...!topic/alt.comp.lang.vb/jjPXuRAGYqI%5B1-25%5D
>
> There are dozens of threads on the same subject, and the stuff in the above
> thread is really just an outline of what the various dpi settings do and how
> VB responds to them, together with a note about the new behaviour in Vista
> and Win7 where at some settings the machine "tells lies" to your program
> about what the dpi settings on that machine actually are, and how to prevent
> it lying (using a dpiaware section in a manifest). Essentially you need to
> declare your program as being "dpi aware" (doing it properly using a manifest
> rather than using the SetProcessDPIAware API function which does not work).
> You then need to make sure that your program is written in such a way that it
> actually /is/ dpi aware.
>
>> but the picturebox does not sit properly inside the form. The
>> picture box is sized by me to fill the form less a small border
>> of the form showing on all edges. The picturebox looks as if
>> it is slid to the right and down on Win 7
>
> Code. Show your code.
>
> Mike

Before I try to isolate the "offending" code which will take
considerable time, I ran a quicky check on Win XP Pro.

I changed the Win XP Pro DPI from 96 to 120 and restarted.
Everything changed size-wise as expected, and my App looks correct just
larger (no distortions or picturebox sliding). Is there a clue there
for me to look at something?

This app was to be a no install, or rather simple .exe copy install
which it does now.

--
Present and unaccounted for.


David Youngblood

8/10/2012 4:45:00 AM

0

"BeeJ" <nospam@spamnot.com> wrote...
>
> My form contains a PictureBox. Inside the picturebox is the image
> control. On Win7, not only does the Image control not stretch properly (I
> am not sizing anything just letting the Image Control do its thing) but
> the picturebox does not sit properly inside the form. The picture box is
> sized by me to fill the form less a small border of the form showing on
> all edges. The picturebox looks as if it is slid to the right and down on
> Win 7 (Note: Win 7, DPI or whatever it is setting to any value it does
> this.

You do realize that the form's border thickness is not the same on Win7 as
it is on XP?

Try this on each OS,
Debug.Print Width - ScaleWidth
Debug.Print Height - ScaleHeight

David



Mike Williams

8/10/2012 7:22:00 AM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:k01qe7$1a5$1@speranza.aioe.org...

> I changed the Win XP Pro DPI from 96 to 120 and restarted.
> Everything changed size-wise as expected, and my App looks
> correct just larger (no distortions or picturebox sliding).

That is the default behaviour of a VB6 Form as far as its initial display
size is concerned (before the user attempts to manually resize it if it
happens to be resizable), but only if your Form does not contain any control
repositioning code of any kind and only if the "new expanded version" is
still smaller than the available screen area. That's because a VB6 Form is
itself dpi aware by default (or at least dpi aware in respect of its client
size and most control sizes and menus, although it is not natively dpi aware
with regards to some controls, such as toolbars for example).

For such a Form the VB6 runtime will expand the size of the client area of
the Form in accordance with the dpi setting of the machine, and it will
expand both the size and the position of all the Form's contained controls
by the same amount. Since the positions of the controls relate to the top
left corner of the client area, and since the client area of the Form I have
described is going to expand by the same amount regardless of the version of
Windows on which it is running and regardless of the thickness of its
various borders, then you will still get the same result (for the Form I
have described) even when running on Vista or on Windows7. (The "dpi aware"
stuff I mentioned is still needed to cure other problems though, especially
on Vista and Windows7).

> Is there a clue there for me to look at something?

Yes. You've got some repositiong code that is messing up the above default
behaviour. That's why I asked for your repositioning code. I'm not saying
that you should not have repositioning code of course (and you definitely
need such code if your Form is user resizable or even on a fixed size Form
if there is a chance that your app will be run on a machine on which its
"new expanded as per dpi size" might be larger than the available screen
area). I'm just saying that your repositioning code is where you need to
look for your problem.

Without seeing your code it is hard to tell what it might be doing wrong,
but it very definitely could be because (as David Youngblood has already
suggested) your code is positioning things in accordance with the overall
size of the Form (rather than its client size which a VB6 Form itself does
by default with regards to dpi) and your code will therefore not be taking
account of the different border and caption bar sizes on different machines
(especially between XP and Vista and Win7).

> This app was to be a no install, or rather simple .exe copy
> install which it does now.

That's okay. You do not need a separate dpi aware manifest file because you
can embed one into your compiled exe. I strongly advise you to use such a
manifest though (ether embedded or separate), even if you fix your current
problem without the need for one (which you should be able to do), because
without a manifest the new Vista and Windows7 "tell lies about the dpi
setting" (which will happen on most Vista and Win7 machines running at 144
dpi or above and also on a few running at 120 dpi) will mess up the
appearance of your Form in other ways.

The "lie to apps about the dpi setting", which some Vista and Windows7
machines will be set to do, happens only to programs which have not declared
themselves to be dpi aware. It causes the operating system to tell the app
that the machine is running at 96 dpi even when it actually might be running
at 120 dpi or 144 dpi or more, and it redirects the app's output to an
offscreen buffer from where the operating system then "stretches" that
buffer onto the display at a larger size in accordance with the actual dpi
setting. This causes fuzzy text on your Form and its controls and it causes
your menus and toolbars to be fuzzy as well and it can sometimes cause other
problems. This "lie to an app about the dpi setting" was introduced in order
to force apps to become larger on a large dpi display even (in fact
especially) if those apps would not otherwise do so. It is therefore just a
"kludge" really and is needed only for apps which are not themselves dpi
aware and it seems a shame to allow the system to apply it (and to cause
this fuzzy text and other possible problems) to a VB6 Form when in fact a
VB6 Form is already at least partially dpi aware by default.

Anyway, as David YoungBlood has said, your current problem is more likely to
be related to your repositioning code positioning things in accordance with
overall size of the Form rather than the size of its client area (which is
why I asked you to post it) so it's up to you whether you bother with dpi
awareness or whether you are happy to instead have a fuzzy looking Form on
lots of machines. It's a design decision ;-)

Mike



mm

8/11/2012 3:51:00 AM

0


"Mike Williams" <Mike@WhiskyAndCoke.com> escribió en el mensaje
news:k02cqe$bbq$1@dont-email.me...
> "BeeJ" <nospam@spamnot.com> wrote in message
> news:k01qe7$1a5$1@speranza.aioe.org...
> You do not need a separate dpi aware manifest file because you can embed
> one into your compiled exe. I strongly advise you to use such a manifest
> though (ether embedded or separate), even if you fix your current problem
> without the need for one (which you should be able to do), because without
> a manifest the new Vista and Windows7 "tell lies about the dpi setting"
> (which will happen on most Vista and Win7 machines running at 144 dpi or
> above and also on a few running at 120 dpi) will mess up the appearance of
> your Form in other ways.

Hello,

In a "normal VB6 application", should we declare in the manifest that it's
DPI aware?


Mike Williams

8/11/2012 8:08:00 AM

0

"Eduardo" <mm@mm.com> wrote in message
news:k04kqm$s1t$1@speranza.aioe.org...
>
> In a "normal VB6 application", should we declare
> in the manifest that it's DPI aware?

Different people will have different opinions, but that is certainly what I
would suggest you should do. A standard VB6 Form is dpi aware by default, at
least insofar as it automatically resizes its client area and resizes and
repositions its contained controls in accordance with the dpi setting of the
machine on which it is running. But it does not declare itself to be dpi
aware and so you need to do that in a manifest, otherwise the OS will lie to
your application and will tell it that it is running on a 96 dpi machine
even when it is not, resulting in the problems I mentioned.

That's not the end of the story of course and you still need to do all the
things you would normally do in order to ensure that your Form still looks
and behaves okay when either the system or the user resizes it, but you
would be doing those things anyway irrespective of the dpi thing.

Mike



mm

8/11/2012 8:23:00 AM

0


"Mike Williams" <Mike@WhiskyAndCoke.com> escribió en el mensaje
news:k053tc$sfb$1@dont-email.me...

>> In a "normal VB6 application", should we declare
>> in the manifest that it's DPI aware?
>
> Different people will have different opinions, but that is certainly what
> I would suggest you should do. A standard VB6 Form is dpi aware by
> default, at least insofar as it automatically resizes its client area and
> resizes and repositions its contained controls in accordance with the dpi
> setting of the machine on which it is running. But it does not declare
> itself to be dpi aware and so you need to do that in a manifest, otherwise
> the OS will lie to your application and will tell it that it is running on
> a 96 dpi machine even when it is not, resulting in the problems I
> mentioned.
>
> That's not the end of the story of course and you still need to do all the
> things you would normally do in order to ensure that your Form still looks
> and behaves okay when either the system or the user resizes it, but you
> would be doing those things anyway irrespective of the dpi thing.

Thanks.


Mike Williams

8/11/2012 8:45:00 AM

0

"Eduardo" <mm@mm.com> wrote in message
news:k04kqm$s1t$1@speranza.aioe.org...

> In a "normal VB6 application", should we declare
> in the manifest that it's DPI aware?

Looking again at what I've just posted, I think I need to amplify just a
little on something I said which might otherwise be slightly misleading.
When I said " . . . otherwise the OS will lie to your application and will
tell it that it is running on a 96 dpi machine even when it is not" I meant
to say that it will do so on systems which have been set by the user to run
at something greater than 96 dpi /and/ where the user has not placed a tick
in the box against "use WinXP dpi scaling" (and of course where the user has
not right clicked the exe you sent him and used its compatibility properties
to prevent the lie). So, some Vista and Windows7 machines running at greater
than 96 dpi will lie to a program that has not declared itself to be dpi
aware and some will not. As a programmer of course you need to accommodate
all machines. Years ago this was not a problem because monitors did not have
very large pixel densities and most computer users were spotty youths with
20/20 vision, but these days with large pixel density monitors and an ageing
"user base" you'll come across more and more machines set to high dpi
settings. Just look at the average age of the people on this newsgroup ;-)
[Cue Tom Shelton with his jokes about dinosaurs!]

Mike