Personnaliser les boites de dialogues

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
Button1: TButton;
procedure OpenDialog1Show(Sender: TObject);
//NE PAS OUBLIER DE METTRE OpenDialog1Show à OnShow de la boite de dialogue
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

Uses commdlg;

procedure TForm1.OpenDialog1Show(Sender: TObject);
const
LB_FILETYPES_ID = 1089; // "File types:" label
LB_FILENAME_ID = 1090; // "File name:" label
LB_DRIVES_ID = 1091; // "Look in:" label

Str1 = 'Le ok';
Str2 = 'Le annuler';
Str3 = 'Le nom';
Str4 = 'Le type';
Str5 = 'Dossier';
begin
SendMessage(GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT,
IDOK,LongInt(Pchar(Str1)));
SendMessage(GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT,
IDCANCEL, LongInt(Pchar(Str2)));
SendMessage(GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT,
LB_FILETYPES_ID, LongInt(Pchar(Str3)));
SendMessage(GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT,
LB_FILENAME_ID, LongInt(Pchar(Str4)));
SendMessage(GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT,
LB_DRIVES_ID, LongInt(Pchar(Str5)));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.execute then
begin
// ...
end;
end;

end.
Ajouter un commentaire
Pseudo
Adresse email
Site internet (optionnel)
Votre commentaire
Fiche de l'article
Mise a jour06/09/2002
VisualisationVu 1562 fois
PublicInternaute zz
CategorieDelphi - Trucs et astuces - Systeme
Auteur de l'article
arachnosoft arachnosoft
connecté le 02/11/2011
1 articles dans la section
Contacter l'auteur