Recent

Author Topic: [SOLVED But got Some Error] Image not show perfectly in other os(windows xp/7)  (Read 1928 times)

e3xpic

  • New Member
  • *
  • Posts: 13
i got question why Image on TImage not show perfectly when open exe file in other os (windows xp/7)
now i use windows 10

https://i.ibb.co/hZzLfX4/untitled3.png

i dont want use Autosize=true
« Last Edit: November 09, 2019, 03:42:51 am by e3xpic »
im newbie in lazarus,tech me.sorry to my grammar translate :)

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Image not show perfectly in other os(windows xp/7)
« Reply #1 on: November 08, 2019, 08:59:02 am »
Try fiddling with the high dpi support settings? Otherwise I can't explain this.
Specialize a type, not a var.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Image not show perfectly in other os(windows xp/7)
« Reply #2 on: November 08, 2019, 11:07:29 pm »
I think more code needs to be shown here...

I would guess that maybe PPI's Are different between the PC's and size calculation is done incorrectly also for centering the image.
The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Image not show perfectly in other os(windows xp/7)
« Reply #3 on: November 09, 2019, 12:16:19 am »
One time stretch = true,
the second picture stretch = false

????

e3xpic

  • New Member
  • *
  • Posts: 13
Re: Image not show perfectly in other os(windows xp/7)
« Reply #4 on: November 09, 2019, 02:01:06 am »
Try fiddling with the high dpi support settings? Otherwise I can't explain this.
got same result
im newbie in lazarus,tech me.sorry to my grammar translate :)

e3xpic

  • New Member
  • *
  • Posts: 13
Re: Image not show perfectly in other os(windows xp/7)
« Reply #5 on: November 09, 2019, 02:01:45 am »
I think more code needs to be shown here...

I would guess that maybe PPI's Are different between the PC's and size calculation is done incorrectly also for centering the image.

there are no code.i just put timage
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Image1: TImage;
  16.   private
  17.  
  18.   public
  19.  
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.lfm}
  28.  
  29. end.
  30.  
im newbie in lazarus,tech me.sorry to my grammar translate :)

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Image not show perfectly in other os(windows xp/7)
« Reply #6 on: November 09, 2019, 02:34:21 am »
Like I said before, there is nothing wrong. The problem is your Windows 10 machine has a higher
Dot per Inch setting and there is more pixel space to show it. Plus you most likely are using the scaling in the Themes..

 Try setting the Stretch Property to true, it should fit in all cases after that.

 The only issue with that is if you roll your mouse over it, you will need to calculate the width rectangle verses the width of the image in the picture property because the two do not share the same size.. One is the width on the screen while the in the Picture property, that is the width of the actual image in memory.



The only true wisdom is knowing you know nothing

e3xpic

  • New Member
  • *
  • Posts: 13
Re: Image not show perfectly in other os(windows xp/7)
« Reply #7 on: November 09, 2019, 02:46:12 am »
Like I said before, there is nothing wrong. The problem is your Windows 10 machine has a higher
Dot per Inch setting and there is more pixel space to show it. Plus you most likely are using the scaling in the Themes..

 Try setting the Stretch Property to true, it should fit in all cases after that.

 The only issue with that is if you roll your mouse over it, you will need to calculate the width rectangle verses the width of the image in the picture property because the two do not share the same size.. One is the width on the screen while the in the Picture property, that is the width of the actual image in memory.


Thank U,new knowledge for me.
work perfect inside windows xp.
im newbie in lazarus,tech me.sorry to my grammar translate :)

e3xpic

  • New Member
  • *
  • Posts: 13
i got  Some Error if setting the Stretch Property to true when run exe into windows xp/7:
1.Image not very clear.
2.Some code not function well,like on mouse enter and etc when related to image .

I think i must change Windows,this windows 10 not support Lazarus nicely ::)

« Last Edit: November 09, 2019, 03:55:47 am by e3xpic »
im newbie in lazarus,tech me.sorry to my grammar translate :)

wp

  • Hero Member
  • *****
  • Posts: 11853
I think i must change Windows,this windows 10 not support Lazarus nicely ::)
Nonsense!

The problem is - it already has been mentioned by others in this thread - that your WinXP/7 and Win10 are setup for different screen resolutions (pixels per inch (PPI), in Windows sometimes termed as "small fonts" / "large fonts" or similar). Set them to the same value and everything will be fine. If this is not possible (because the screen diameters are significantly different) you must activate the LCL scaling feature of Lazarus ("Project" > "Project options" > check "Use LCL scaling" and "Use manifest resource", select "DPI awarenesse" to "on" (or any other non-"off" value, depending on your system). In Laz 2.0+ these settings are active by default.

Even with LCLScaling there is an issue with images because your application only has one size of the image. Ideally the image should be larger than the TImage at the highest PPI settings. In this case, in contrast to jamie's recommendation, I would not use the "Stretch" property to adjust the image size because this distorts the image if the width-to-height ratio of TImage and picture are different. Setting "Proportional" to true, however, keeps this ratio and gives the reduced image much better look.

jamie

  • Hero Member
  • *****
  • Posts: 6090
If the image is expected to be editable then I suggest using a TscrollBox and manipulate the Image.

And yes, proportional is better for viewing purposes.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018