[Lazarus] Note about LCL GetDefaultGlyph

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Note about LCL GetDefaultGlyph

Free Pascal - Lazarus mailing list
+
+function GetDefaultGlyph(ResourceName: string; ScalePercent: Integer =
100): TCustomBitmap;
+begin
+  Result := TPortableNetworkGraphic.Create;
+  if ScalePercent<>100 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

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Note about LCL GetDefaultGlyph

Free Pascal - Lazarus mailing list
On 01.05.2018 16:48, AlexeyT via Lazarus wrote:

> +
> +function GetDefaultGlyph(ResourceName: string; ScalePercent: Integer
> = 100): TCustomBitmap;
> +begin
> +  Result := TPortableNetworkGraphic.Create;
> +  if ScalePercent<>100 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
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus