hola amigos del foro, contarles q estoy haciendo un sistema en el cual gracias a la web y al foro hice mi propio mesagebox y todo iva bien hasta q no me di cuentas q los iconos q se muestran son muy pequeños y me exigen q se vea mas grandes pero la verdad nose como hacerlo ahi les muestro la unit es la siguiente:
Código Delphi
[-]
unit UnitShowMessage;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, LMDControl, LMDBaseControl, LMDBaseGraphicButton,
LMDCustomSpeedButton, LMDSpeedButton, Buttons, ExtCtrls,
LMDCustomButton, LMDButton, ImgList;
type
TFrmMessageBox = class(TForm)
LTitulo: TLabel;
LMensaje: TLabel;
BAceptar: TLMDButton;
BCancelar: TLMDButton;
PBMovible: TPaintBox;
BReintentar: TLMDButton;
PBIcono: TPaintBox;
ILIcono: TImageList;
ImageList1: TImageList;
procedure FormShow(Sender: TObject);
procedure PBMovibleMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PBMovibleMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure PBMovibleMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PBIconoPaint(Sender: TObject);
private
RatonPulsado: Boolean;
Punto: TPoint;
public
end;
function Maximo (a,b:integer):integer;
FUNCTION MsgBox (Titulo, Mensaje: String; Flags: DWord):integer;
var
FrmMessageBox: TFrmMessageBox;
IndiceImagen:integer;
implementation
{$R *.dfm}
procedure TFrmMessageBox.FormShow(Sender: TObject);
begin
RatonPulsado := False;
end;
procedure TFrmMessageBox.PBMovibleMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
IF Button = mbLeft THEN
BEGIN
RatonPulsado := True;
Punto.x := x;
Punto.y := y;
END;
end;
function Maximo(a,b:integer):integer;
begin
if a>b then
Maximo:=a
else
Maximo:=b;
end;
FUNCTION MsgBox (Titulo, Mensaje: String; Flags: DWord): Integer;
CONST
PosLeft = 112;
PosWidth = 320;
LeftBotones = 25;
SepBotones = 7;
VAR
Botones, Icono: Word;
AlineacionDerecha: Boolean;
ResModal: TModalResult;
IdBotonPulsado: Integer;
BEGIN
Botones := Flags AND $F;
Icono := Flags AND $F0;
AlineacionDerecha := (Flags AND $F0000) = $80000;
IndiceImagen := 0;
WITH FrmMessageBox DO
BEGIN
Caption := Titulo;
LTitulo.AutoSize := False;
LMensaje.AutoSize := False;
LTitulo.Caption := Titulo;
LTitulo.Left := LeftBotones;
LTitulo.Width := 2 *(PosWidth DIV 3);
LTitulo.AutoSize := True;
LMensaje.Caption := Mensaje;
LMensaje.Left := PosLeft;
LMensaje.Width := PosWidth;
LMensaje.Alignment := taLeftJustify;
LMensaje.AutoSize := True;
LMensaje.Top := LTitulo.Top + LTitulo.Height + 15;
BAceptar.Top := LMensaje.Top + Maximo(LMensaje.Height, PBIcono.Height);
BCancelar.Top := BAceptar.Top;
BReintentar.Top := BAceptar.Top;
ClientHeight := BAceptar.Top + BAceptar.Height + 20;
CASE Botones OF
MB_OK:
BEGIN
BAceptar.Visible := True;
BCancelar.Visible := False;
BReintentar.Visible := False;
BAceptar.Caption := 'ACEPTAR';
BAceptar.Left := Width DIV 2 - BAceptar.Width DIV 3;
BAceptar.Width:=90;
END;
MB_OKCANCEL:
BEGIN
BAceptar.Visible := True;
BCancelar.Visible := True;
BReintentar.Visible := False;
BAceptar.Caption := ' Aceptar';
BCancelar.Caption := ' Cancelar';
BAceptar.Left := Width DIV 3 - BAceptar.Width DIV 3;
BCancelar.Left := BAceptar.Left + BAceptar.Width + SepBotones;
END;
MB_RETRYCANCEL:
BEGIN
BAceptar.Visible := False;
BCancelar.Visible := True;
BReintentar.Visible := True;
BCancelar.Caption := ' Cancelar';
BReintentar.Caption := ' Reintentar';
BReintentar.Left := Width DIV 3 - BReintentar.Width DIV 3;
BCancelar.Left := BReintentar.Left + BReintentar.Width + SepBotones;
END;
MB_YESNO:
BEGIN
BAceptar.Visible := True;
BCancelar.Visible := True;
BReintentar.Visible := False;
BAceptar.Caption := ' SI';
BCancelar.Caption := ' NO';
BAceptar.Left := 112;
BAceptar.Width:=49;
BCancelar.Left := 232;
END;
MB_YESNOCANCEL:
BEGIN
BAceptar.Visible := True;
BCancelar.Visible := True;
BReintentar.Visible := True;
BAceptar.Caption := ' Sí';
BCancelar.Caption := ' No';
BReintentar.Caption := ' Cancelar';
BAceptar.Left := LeftBotones;
BCancelar.Left := BAceptar.Left + BAceptar.Width + SepBotones;
BReintentar.Left := BCancelar.Left + BCancelar.Width + SepBotones;
END;
END;
CASE Icono OF
MB_ICONINFORMATION:
IndiceImagen := 1;
MB_ICONERROR:
IndiceImagen := 2;
MB_ICONEXCLAMATION:
IndiceImagen := 3;
MB_ICONQUESTION:
IndiceImagen := 4;
END;
IF AlineacionDerecha THEN LMensaje.Alignment := taRightJustify;
END;
ResModal := FrmMessageBox.ShowModal;
IdBotonPulsado := 0;
CASE ResModal OF
mrOk: IdBotonPulsado := IDOK;
mrCancel: IdBotonPulsado := IDCANCEL;
mrAbort: IdBotonPulsado := IDABORT;
mrRetry: IdBotonPulsado := IDRETRY;
mrIgnore: IdBotonPulsado := IDIGNORE;
mrYes: IdBotonPulsado := IDYES;
mrNo : IdBotonPulsado := IDNO;
END;
MsgBox := IdBotonPulsado;
END;
procedure TFrmMessageBox.PBMovibleMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
IF RatonPulsado THEN
SetBounds(x - Punto.x + Left, y - Punto.y + Top, Width, Height);
end;
procedure TFrmMessageBox.PBMovibleMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
IF Button = mbLeft THEN RatonPulsado := False;
end;
procedure TFrmMessageBox.PBIconoPaint(Sender: TObject);
begin
ILIcono.Draw(PBIcono.Canvas, 0, 0, IndiceImagen);
end;
end.
y desde otras unidades lo llamo por ejemplo de la siguiente manera:
IF MsgBox ('SISTEMA DE ASISTENCIA MEDICA','¿QUIERE SALIR DEL SISTEMA ?',
MB_YESNO + MB_ICONQUESTION)=IDYES THEN
application.Terminate;
muchas gracias por sugerencias y la ayuda q me brinden