Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element sizes on High-Definition Displays (Windows scaling is 200% or above) DPI is not 96 #10

Open
maximmasiutin opened this issue Jan 9, 2017 · 2 comments

Comments

@maximmasiutin
Copy link

Thank you for maintaining the great TBX software.

Please consider adding support for High-definition monitors. Nowadays, lot of users have Windows interface scaling level set to 200% and more, to accommodate to 4K displays, so the screen density is no longer 96 DPI. In Toolbar2000, all item sizes are programmed in physical pixels, not adjusted to screen DPI, so the items like toolbar grips, chevrons, arrows look very small.

So the adjustments are needed to multiply element size to actual screen DPI and divide by 96 (normal DPI). It is usually obtaining by using MulDiv instruction.

For example, see how GetTBXDragHandleSize from TBXThemes.pas will look like:

function GetTBXDragHandleSize(const ADC: HDC; const ToolbarInfo: TTBXToolbarInfo): Integer;
const
FDragHandleSizes: array [Boolean, 0..2] of Integer = ((9, 0, 6), (14, 14, 14));
begin
with ToolbarInfo do
begin
if AllowDrag then
Result := MulDiv(FDragHandleSizes[(CloseButtonState and CDBS_VISIBLE) <> 0, DragHandleStyle], GetDeviceCaps(ADC, LOGPIXELSY), 96)
else
Result := 0;
end;
end;

Please consider adding support for custom DPI, other than 96, to accommodate modern high resolution monitors.

I have made a few changes to the code, but it would be better if you fully implement custom DPI support in the main code base.

Thank you very much again for maintaining the TBX library.

@plashenkov
Copy link
Owner

Hey, sorry for such late reply. GitHub did not notify me about the issues and I was wonder when discovered them here.

Yes, HiDPI is important thing. If you can help with it, please consider making a pull request.

@WangPingGang
Copy link

There any progress in this problem?
In 4K Resolution display, the Windows scaling is 250%, some icon is really tiny(eg. checkbox, submenu arrow).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants