Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-05

Note about LCL GetDefaultGlyph

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

AlexeyT
+
+function GetDefaultGlyph(ResourceName: string; ScalePercent: Integer =
100): TCustomBitmap;
+begin
+  Result := TPortableNetworkGraphic.Create;
+  if ScalePercent100 then
+    ResourceName := ResourceName+'_'+IntToStr(ScalePercent);
+  Result.LoadFromResourceName(hInstance, ResourceName);
+end;
+

So for scale 140% func gets suffix _140, but better use suffix _100 (for all values 100..149).
140% can be set in Windows dialog, I think.
Same for scale 210%, func gets suffix _210, but should _200.

AT

Regards, Alexey

Reply by email

Ondrej Pokorny
to AlexeyT
AlexeyT wrote 15 lines
+ +function GetDefaultGlyph(ResourceName: string; ScalePercent: Integer = 100): TCustomBitmap; +begin +  Result := TPortableNetworkGraphic.Create; +  if ScalePercent100 then +    ResourceName := ResourceName+'_'+IntToStr(ScalePercent); +  Result.LoadFromResourceName(hInstance, ResourceName); +end; + So for scale 140% func gets suffix _140, but better use suffix _100 (for all values 100..149). 140% can be set in Windows dialog, I think. Same for scale 210%, func gets suffix _210, but should _200.

It's your responsibility to supply a valid ScalePercent value. If you want some handling (210 -> 200), do it yourself in your code. The LCL does it as well, see e.g. TLCLGlyphs.GetImageIndex.

Ondrej

Reply by email