function MiMensaje(XTexto, XTitulo: String): Boolean;
var
LForm: TForm;
CaptionIndex, i: integer;
LNombres: array of string;
LFondo, LColor: TColor;
LICono: TMsgDlgType;
LBotones: TMsgDlgButtons;
begin
LFondo := clGreen;
LColor := clWhite;
LIcono := mtInformation;
LBotones := [mbOK];
SetLength(LNombres, 1);
LNombres[0] := '&Cerrar';
if XTitulo = 'Cuidado' then
begin
LFondo := clYellow;
LColor := clBlack;
LIcono := mtConfirmation;
LBotones := [mbYes,mbNo];
SetLength(LNombres, 1);
LNombres[0] := '&Si';
end
else if XTitulo = 'Peligro' then
begin
LFondo := clRed;
LColor := clYellow;
LIcono := mtWarning;
LBotones := [mbYes,mbNo,mbAbort];
SetLength(LNombres, 3);
LNombres[0] := '&Si';
LNombres[1] := '&No';
LNombres[2] := '&Cerrar';
end;
LForm := CreateMessageDialog(XTexto, LIcono, LBotones);
LForm.Caption := XTitulo;
LForm.Color := LFondo;
LForm.BorderIcons := [];
CaptionIndex := 0;
for i := 0 to LForm.ComponentCount - 1 do
begin
if (LForm.Components[i] is TLabel) then
begin
TLabel(LForm.Components[i]).Font.Style := [fsBold];
TLabel(LForm.Components[i]).Font.Color := LColor;
TLabel(LForm.Components[i]).Font.Size := 12;
end;
if (LForm.Components[i] is TButton) then
begin
if CaptionIndex > High(LNombres) then
Break;
TButton(LForm.Components[i]).Caption := LNombres[CaptionIndex];
Inc(CaptionIndex);
end;
end;
with LForm do
begin
try
ShowModal;
finally
Free;
end;
end;
if LForm.ModalResult = mrYes then
Result := True
else
Result := False;
end;