Jump to content
Sign in to follow this  
dummzeuch

Making Delphi 2007 HighDPI-aware

Recommended Posts

2 hours ago, Attila Kovacs said:

do they have an own virtualtree?

Yes.

  • Thanks 1

Share this post


Link to post
Posted (edited)
1 hour ago, Attila Kovacs said:

It makes no sense changing it runtime

If you have got more than one monitor with different DPI settings, it makes all lot of sense to change the IDE scaling on the fly. Just imagine moving a window from a 4K monitor with 150% scaling to a HD monitor with 100%.

 

(And guess who has got such a setup...)

Edited by dummzeuch
  • Haha 1

Share this post


Link to post
Posted (edited)
3 hours ago, Attila Kovacs said:

Setting the Indent property changes the layout immediately,

Yes, this seems to work, even when reading it and setting it to the same value. It also makes the OnMeasureItem event redundant.

(edit: No that event is still necessary.)

 

That solves the problem for the tree view, but unfortunately not for the TVirtualTreeViews used in grid mode (e.g. the message window or the breakpoint list). There even setting the font size does not make any difference.

Edited by dummzeuch
  • Like 1

Share this post


Link to post

Yes, I remember playing a lot with all these things without "rtti" until I gave up.

I'd now try to iterate through the nodes using those typinfo's.

Share this post


Link to post
Posted (edited)

It was fun playing around with this, but the result is a bit disappointing once you get over the first "wow, it works".

Just in case anybody else wants to have a go, here is the result of the last two days of "work".

Note that the source checks whether Application.ExeName is 'hbds.exe' to decide whether to install the wizard or not.

To get this to work, you will either have to remove that check or copy the bds.* files in the Delphi 2007 bin directory to hbds.* and of course set the Windows compatibility options for that hbds.exe rather than for bds.exe .

It will add a new menu "High DPI" to the IDE's main menu with two entries "patch" and "un-patch" which should be self explanatory.

 

Have fun, but remember: I will not fix your computer if you break it. 😉

 

@Attila Kovacs thanks for that idea which was quite fun to play around with. Take whatever you can use from the attached sources.

 

Delphi2007HighDpi.zip

Edited by dummzeuch
attached the wrong file
  • Like 1

Share this post


Link to post

Thx, that RTTI was already a big help for the future.

I'm sorry that the result is disappointing, I'm pretty happy with it and as I said, I'm using this not just for the IDE but for my old D2007 apps too with some adjustment on some controls works pretty solid and looks good on 4k.

Share this post


Link to post
26 minutes ago, Attila Kovacs said:

As I said, I'm using this not just for the IDE but for my old D2007 apps too with some adjustment on some controls works pretty solid and looks good on 4k.

It will probably work much better for this use case than for the IDE, because you can simply fix the source code rather than trying to patch the executable at runtime.

 

I guess you are aware that instead of setting the Windows compatibility options for an executable you can simply add a manifest to your executable that tells Windows it is HighDPI aware?

Share this post


Link to post
6 minutes ago, dummzeuch said:

I guess you are aware that instead of setting the Windows compatibility options for an executable you can simply add a manifest to your executable that tells Windows it is HighDPI aware?

Yes but I must have been a lazy dog again.

Share this post


Link to post

As suggested I grabbed these posts and created a new topic.

  • Thanks 2

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×