Recent

Author Topic: How to bind component sizes to screen resolution?  (Read 1456 times)

shyub

  • Full Member
  • ***
  • Posts: 124
How to bind component sizes to screen resolution?
« on: March 12, 2021, 01:17:48 pm »
The form contains jImageBtn, images for which are stored in jImageList. At different screen resolutions, the size of the pictures does not correspond to the size of the buttons.
How can I determine the screen resolution so that I can connect the corresponding jImageList, or maybe there is some other way to make the image fit the size of the button?

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: How to bind component sizes to screen resolution?
« Reply #1 on: March 12, 2021, 01:41:38 pm »
I've just come back to this after spotting that you're specifically interested in Android... below is for a PC but might still be relevant.

Code: Pascal  [Select][+][-]
  1.   RESULT:= RESULT + 'Screen ' + DisplayIdentifier + ', displaying ' +
  2.                 IntToStr(Screen.Width) + 'x' + IntToStr(Screen.Height) +
  3.                 ' at ' + IntToStr(Screen.PixelsPerInch) + ' dpi';
  4.  

MarkMLl
« Last Edit: March 12, 2021, 01:43:13 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

shyub

  • Full Member
  • ***
  • Posts: 124
Re: How to bind component sizes to screen resolution?
« Reply #2 on: March 12, 2021, 05:39:13 pm »
Thanks, but that's not it. In Windows, I can find out when the program starts (onCreate), but I don’t know where to find out in LAMW.

shyub

  • Full Member
  • ***
  • Posts: 124
Re: How to bind component sizes to screen resolution?
« Reply #3 on: March 12, 2021, 05:43:15 pm »
The picture does not apply to this issue, I can not delete it.

shyub

  • Full Member
  • ***
  • Posts: 124
Re: How to bind component sizes to screen resolution?
« Reply #4 on: March 17, 2021, 11:22:52 am »
You can find out the screen resolution like this:
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);
  2. begin
  3.   jTextView1.Text:=IntToStr(AndroidModule1.Width)+'x'+IntToStr(AndroidModule1.Height);
  4. end;

 

TinyPortal © 2005-2018