HELP: weird high DPI problem?? - Programmer

This is a discussion on HELP: weird high DPI problem?? - Programmer ; A guy at work noticed that a custom control I wrote doesn't work correctly if you mess with the DPI settings. This control is the blue/rounded Explorer Bar from Windows XP. This control is built on top of a vertical ...

Thread: HELP: weird high DPI problem??

1. HELP: weird high DPI problem??

A guy at work noticed that a custom control I wrote doesn't work correctly
if you mess with the DPI settings.

This control is the blue/rounded Explorer Bar from Windows XP.

This control is built on top of a vertical rebar and I had to do a bunch of
tricks to get it to work right.

Anyways, in one of the routines, I calculate the exact height the control
should be, if this calculation is to small, the rebar gets all garbled, if
its too big, there are painting issues.

I noticed in this calculation if I add in a fudge factor, it fixes the DPI
related problems. The problem is that outside of hand calculating these
fudge factors from 0% DPI to 200+% DPI, there doesn't seem to be a
relationship as you would expect this fudge factor to scale with the DPI.

At 100% (normal) the fudge factor is 0
At 120% its 3
At 150% its 7
At 200% its 12

The weird thing, is that it doesn't matter how many groups there are in the
control or how many items are in each group, the fudge factor seems to be
constant.

Also in this calculation function I am already adding a fudge factor of 18
for padding around the control, but this padding when examining the screen
shots remains constant, so Windows doesn't seem to be scaling that.

So really my fudge factors are:

100% 14 + 4 + 0 = 18
125% 14+4 + 3 = 21
150% 14 + 4 + 7 = 25
200% 14 + 4 + 12 = 30

at the beginning it seems to be adding 3 for every 25%, but then for the 50%
jump it adds 5.

As I said before, at first I assumed that this error should be related to
the number of groups or items in the groups, but its not, its related to the
DPI and a constant some how.

Any ideas? these fudge factors dont even seem proportional to anything or
each other.

2. Re: weird high DPI problem??

"No Spam" wrote in message
> A guy at work noticed that a custom control I wrote doesn't work correctly
> if you mess with the DPI settings.
>
> This control is the blue/rounded Explorer Bar from Windows XP.
>
> This control is built on top of a vertical rebar and I had to do a bunch

of
> tricks to get it to work right.
>
> Anyways, in one of the routines, I calculate the exact height the control
> should be, if this calculation is to small, the rebar gets all garbled, if
> its too big, there are painting issues.
>
> I noticed in this calculation if I add in a fudge factor, it fixes the DPI
> related problems. The problem is that outside of hand calculating these
> fudge factors from 0% DPI to 200+% DPI, there doesn't seem to be a
> relationship as you would expect this fudge factor to scale with the DPI.
>
> At 100% (normal) the fudge factor is 0
> At 120% its 3
> At 150% its 7
> At 200% its 12
>
> The weird thing, is that it doesn't matter how many groups there are in

the
> control or how many items are in each group, the fudge factor seems to be
> constant.
>
> Also in this calculation function I am already adding a fudge factor of 18
> for padding around the control, but this padding when examining the screen
> shots remains constant, so Windows doesn't seem to be scaling that.
>
> So really my fudge factors are:
>
> 100% 14 + 4 + 0 = 18
> 125% 14+4 + 3 = 21
> 150% 14 + 4 + 7 = 25
> 200% 14 + 4 + 12 = 30
>
> at the beginning it seems to be adding 3 for every 25%, but then for the

50%
> jump it adds 5.
>
> As I said before, at first I assumed that this error should be related to
> the number of groups or items in the groups, but its not, its related to

the
> DPI and a constant some how.
>
> Any ideas? these fudge factors dont even seem proportional to anything or
> each other.
>
>
>
>