GxIcon.CreateFromFileS

Fore Syntax

CreateFromFileS(FileName: String; Size: IGxSize);

Fore.NET Syntax

CreateFromFileS(FileName: String; Size: Prognoz.Platform.Interop.Drawing.GxSize);

Parameters

FileName. Path and the name of the file that contains the icon.

Size. The sizes, according to which the icon is scaled.

Description

The CreateFromFileS constructor creates an icon from the specified file scaling it to the sizes specified in the Size sizes parameter.

Fore Example

Function GetScalingIconFromFile(FileName: String; SWidth: Integer; SHeight: Integer): IGxIcon;
Var
    ScalingSize: IGxSize;
    OutIcon: IGxIcon;
Begin
    If File.Exists(FileName) Then
        ScalingSize := New GxSize.Create(SWidth, SHeight);
        OutIcon := New GxIcon.CreateFromFileS(FileName, ScalingSize);
        Return OutIcon;
    Else
        Return Null;
    End If;
End Function GetScalingIconFromFile;

This function returns the icon obtained from the file and scaled in accordance with the specified sizes.

Fore.NET Example

Imports System.IO;
Imports Prognoz.Platform.Interop.Drawing;

Function GetScalingIconFromFile(FileName: String; SWidth: Integer; SHeight: Integer): GxIcon;
Var
    ScalingSize: GxSize;
    OutIcon: GxIcon;
Begin
    If File.Exists(FileName) Then
        ScalingSize := New GxSizeClass();
        ScalingSize.Create(SWidth, SHeight);
        OutIcon := New GxIconClass();
        OutIcon.CreateFromFileS(FileName, ScalingSize);
        Return OutIcon;
    Else
        Return Null;
    End If;
End Function;

This function returns the icon obtained from the file and scaled in accordance with the specified sizes.

See also:

GxIcon