Back to Devexpress

TdxSkinController.OnSkinControl Event

vcl-dxskinsform-dot-tdxskincontroller.md

latest5.0 KB
Original Source

TdxSkinController.OnSkinControl Event

Allows you to prevent the skin controller from applying the active skin to a supported control from the standard VCL Library.

Declaration

delphi
property OnSkinControl: TdxSkinControlEvent read; write;

Remarks

The TdxSkinController component can apply skins to standard forms and a number of standard VCL controls in addition to DevExpress forms and controls.

You can handle the OnSkinControl event to prevent the sin controller from applying the active skin and palette to any supported control (or its descendant) from the standard VCL library.

Tip

This technique can be useful if you do not need to apply DevExpress skins to supported standard VCL controls or third-party components based on these controls.

Supported Standard VCL Controls

Event Occurrence

The OnSkinControl event occurs once per supported standard VCL control when the TdxSkinController component is about to apply the active skin to the control. A Refresh procedure call raises the OnSkinControl event for supported standard controls.

Event Parameters

You can use the AControl parameter to access and identify the currently processed standard VCL control. To prevent the skin controller from applying the active skin to the currently processed control, you can assign False to the UseSkin[1] parameter.

Refer to the TdxSkinControlEvent procedural type description for detailed information on parameters accessible within an OnSkinControl event handler.

Redraw Skinned Controls

If you dynamically change skin-related settings within an OnSkinControl event handler in response to certain condition changes in your application, call the Refresh procedure to redraw all skinned forms and controls.

Code Example: Exclude Standard Controls from Skinning

The TdxSkinController component applies the active skin and palette to all forms and all supported controls in the application.

The following code example prevents the WXI skin from being applied to all TButton controls:

delphi
procedure TMyForm.dxSkinController1SkinControl(Sender: TObject;
  AControl: TWinControl; var UseSkin: Boolean);
var
  ASkinController: TdxSkinController;
begin
  ASkinController := Sender as TdxSkinController;
  if((AControl.ClassType = TButton) and (ASkinController.SkinName = 'WXI')) then
    UseSkin := False;
end;
cpp
void __fastcall TMyForm::dxSkinController1SkinControl(TObject *Sender,
  TWinControl *AControl, bool *&AProperties)
{
  TdxSkinController *ASkinController;
  // ...
  ASkinController = dynamic_cast<TdxSkinController*>(Sender);
  if((AControl->ClassType() == __classid(TButton)) && (ASkinController->SkinName == "WXI"))
    UseSkin = false;
}

Footnotes

  1. The initial UseSkin parameter value matches the UseSkins property value.

See Also

Global Appearance Settings

TdxSkinController.OnSkinForm Event

TdxSkinController.Refresh Procedure

TcxCustomLookAndFeelController.UseSkins Property

TdxSkinController Class

TdxSkinController Members

dxSkinsForm Unit