Skip to main content

dxSkinsUserSkinLoadFromFile(string,string) Method

Loads a skin from a specified SKINRES file.

Declaration

function dxSkinsUserSkinLoadFromFile(const AFileName: string; const ASkinName: string = ''): Boolean;

Parameters

Name Type Description
AFileName string

The absolute or relative path to the source SKINRES file.

ASkinName string

Optional. Specifies the name of the required skin in the source SKNIRES file (AFileName).

If this parameter is omitted, the function loads the first skin in the source SKINRES file if it contains multiple skins.

Returns

Type Description
Boolean

True if the skin load operation is successful; otherwise, False.

Remarks

Call the dxSkinsUserSkinLoadFromFile function to load a custom skin from a SKINRES file created in the Skin Editor tool.

Custom Skin Validation

A custom skin can miss certain elements available in the current version of DevExpress skins. You can call the dxSkinsLoadedUserSkinHasMissingElements function to validate the loaded skin after a dxSkinsUserSkinLoadFromFile function call.

Code Example

The code example below loads a custom skin from a SKINRES file and applies the loaded skin to an application. If an attempt to load a custom skin is unsuccessful, the code example applies the WXICompact skin and its Sharpness palette to the application.

uses
  dxSkinsDefaultPainters; // Declares the dxSkinsUserSkinLoadFromFile function
// ...
begin
  dxSkinController1.NativeStyle := False;
  if(dxSkinsUserSkinLoadFromFile('MySkin.skinres'))
    dxSkinController1.SkinName := 'UserSkin'
  else
  begin
    dxSkinController1.SkinName := 'WXICompact';
    dxSkinController1.SkinPaletteName = 'Sharpness';
  end;
end;
See Also