When scaling is used Windows changes the logical number of pixels per inch – so the Screen.PixelsPerInch will be higher for scaled displays. Now, TScreen’s PixelsPerInch indicates the number of screen pixels that make up a logical inch in the vertical direction. What actually happens (when the Scaled property is set to true) is that when the application starts the saved/stored value of the PixelsPerInch will be compared to the value of Screen.PixelsPerInch. The Help states that PixelsPerInch represents the proportion of the font on the system on which the form was designed. To be honest, I’ve completely ignored the PixelsPerInch property for years, did not even knew it was there (you can even change it at design time, omg). Your arsenal: the Scaled property, Screen.PixelPerInch property, ChangeScale method, ScaleBy method, MulDiv method.Īgain, if you’ve read the mentioned articles in the previous post you know that every Delphi form has a property called Scaled but also a property called PixelsPerInch. What follows are some “tricks” and compromises I’ve used to fix my application and make it really high-dpi aware. In more complex form design you could even see sections of your user interface completely not re-sized / re-scaled. Your nice custom drawn combo boxes appear to be ok, but as you drop down the pick list – it does not display correctly. All the controls that you create dynamically do not look correctly – they are either not at the correct location or you do not see the full width of them. All buttons of type TBitBtn or TSpeedButton where you used the Glyph property to display a nice image of 16×16 pixels – those images appear super small. However, some elements do not look right! You’ll notice your menu glyphs are still small (barely visible). The user interface controls are no longer super small nor they appear stretched. You now run the application – if you are lucky – all will be ok. Or even better, find a 4K display device (say a laptop) with default scaling set (probably to something) higher than 100% (let’s say 250% or even more). What you then do is go to Control Panel – Screen Resolution – and change (depending on your Windows version) the scaling level to 150%. Of course, that’s to expect as your development machine display DPI value is the same at design and run time. You rebuild the application, run on your development machine – and you see no changes. If you are using Delphi 10 Seattle or newer – you simply tick the “Enable High-DPI” check inside the Manifest file group box in Project – Options – Application. You also know you need to include a custom manifest file (as a resource) specifying your application is high DPI aware.There’s a Scaled property every Delphi form has – and you want it to be set to True.If you’ve gone through the links in the mentioned article you know that Luckily, as presented in the previous post, there are *only* a couple of steps you need to do to make your application react correctly on different display scaling levels. Your non high-dpi aware Delphi application might look nice on your development machine, but it certainly looks super small or ugly stretched on your client’s shiny new 4K resolution laptop – and it really does not work – at least not how you and your client would expect! To respace the buttons, resize the radio group component.So you want to go down the high-DPI road? Feeling alone? I did □ The classical answer “it works on my machine” will not be sufficient here. Display the radio buttons in a single column or in multiple columns by setting the value of the Columns property. The value of the ItemIndex property determines which radio button is currently selected. To add radio buttons to a radio group, edit the Items property in the Object Inspector each string in Items makes a radio button appear in the group box with the string as its caption. The radio group component ( TRadioGroup) simplifies the task of assembling radio buttons and making them work together. The Caption property contains text that labels the group box at run time. After placing a group box on a form, select components from the Tool palette and place them in the group box. The most commonly grouped controls are radio buttons. A group box ( TGroupBox) arranges related controls on a form.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |