Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

dxSkinsUserSkinLoadFromFile(string,string) Method

Loads a skin from a specified SKINRES file.

#Declaration

Delphi
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: Apply Custom Skins

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