[Lazarus] Note about LCL GetDefaultGlyph

Ondrej Pokorny lazarus at kluug.net
Tue May 1 17:10:52 CEST 2018


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


More information about the Lazarus mailing list