Vcl.Themes.TStyleManager.SystemHooks

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

class property SystemHooks: TSystemHooks read FSystemHooks write SetSystemHooks default [shMenus, shDialogs, shToolTips];

C++

/* static */ __property TSystemHooks SystemHooks = {read=FSystemHooks, write=SetSystemHooks, default=7};

Propriétés

Type Visibilité  Source Unité  Parent
property public
Vcl.Themes.pas
Vcl.Themes.hpp
Vcl.Themes TStyleManager


Description

La propriété SystemHooks permet l'affichage des menus stylés, des dialogues communs et des conseils.

Lorsqu'un style est appliqué à l'application VCL par l'intermédiaire du TStyleManager, les valeurs suivantes affichent des menus stylés, des dialogues communs et des conseils selon le style défini.

La propriété inclut ces valeurs par défaut :

  • shMenus affiche les menus stylés.
  • shDialogs affiche les dialogues communs stylés. (Cela s'applique uniquement à la version Seattle et aux versions supérieures).
  • shToolTips affiche des conseils. (Cela s'applique uniquement à la version Seattle et aux versions supérieures).

Pour activer / désactiver un intercepteur système, il vous suffit d'ajouter la valeur à la propriété énumérée ou de l'en retirer.

Par exemple :

  1. Utilisez un TCheckBox pour afficher un dialogue stylé.
  2. Utilisez l'événement OnClick d'un bouton pour exécuter un composant TOpenDialog.
Remarque : Les composants Dialogues communs se trouvent dans la catégorie Dialogues de la palette d'outils.

Pour Delphi :

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
 if CheckBox1.Checked then
   //When checking the checkbox, the value is added to the property and common dialog ares styled.
   TStyleManager.SystemHooks := TStyleManager.SystemHooks + [shDialogs] 
 else
   //When unchecking the checkbox, the value is removed from the property and the style does not apply to common dialogs.
   TStyleManager.SystemHooks := TStyleManager.SystemHooks - [shDialogs] 
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
  OpenDialog1.Execute; //Opens the dialog.
end;

Pour C++ :

void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
if (CheckBox1->Checked) {
  //One possible way to add the value.
  TStyleManager::SystemHooks = TStyleManager::SystemHooks + (TStyleManager::TSystemHooks() << TStyleManager::TSystemHook::shDialogs); 
  //Another possible way to add the value.
  StyleManager::SystemHooks = TStyleManager::SystemHooks << TStyleManager::TSystemHook::shDialogs; } 
else {
  //One possible way to remove the value.
  TStyleManager::SystemHooks = TStyleManager::SystemHooks - (TStyleManager::TSystemHooks() << TStyleManager::TSystemHook::shDialogs);
  //Another possible way to add the value.
  TStyleManager::SystemHooks = TStyleManager::SystemHooks >> TStyleManager::TSystemHook::shDialogs; }
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  OpenDialog1->Execute(); //Opens the dialog.
}

Voir aussi