SCAR Code:
program New;
var
frmDesign : TForm;
BitBtn1 : TBitBtn;
labelwidth, txtsize, msgboxheight : Integer;
txtup : string;
txtbold, txtit,txtuline:boolean;
Memo1 : TMemo;
Msg:array of String;
MsgPos:integer;
procedure LoadMsgBoxForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 50;
frmDesign.Width := labelwidth+16;
frmDesign.Height := msgboxheight+78;
frmDesign.Caption := txtup;
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Memo1 := TMemo.Create(frmDesign);
Memo1.Color := clBtnFace;
memo1.Parent := frmDesign;
memo1.Font.size:= txtsize;
memo1.ReadOnly:=true;
For MsgPos:=0 to high(Msg) do
memo1.Lines.add (msg[MsgPos]);
If txtbold then
memo1.Font.Style := [fsBold];
If txtit then
memo1.Font.Style := [fsItalic];
If txtuline then
memo1.Font.Style := [fsUnderline];
memo1.Left := 0;
memo1.Top := 0;
memo1.Width := labelWidth;
memo1.Height := msgboxheight;
BitBtn1 := TBitBtn.Create(frmDesign);
BitBtn1.Parent := frmDesign;
BitBtn1.Left := (memo1.Width-137);
BitBtn1.Top := memo1.Height;
BitBtn1.Width := 137;
BitBtn1.Height := 41;
BitBtn1.Caption := 'Ok';
BitBtn1.ModalResult := 1;
BitBtn1.TabOrder := 8;
end;
procedure ShowMsgBoxFormModal;
begin
frmDesign.ShowModal;
end;
Procedure MsgBox(Message:array of string;Uptext:String;Size:integer;Bold,Underlined,Italic:boolean;width,height:integer;sound:Boolean);
Var
V: TVariantArray;
begin
setarraylength(Msg,High(message)+1)
setarraylength(Message,High(message)+1)
labelwidth:=width;
msgboxheight:=height;
for MsgPos:= 0 to high(message) do
msg[MsgPos]:=message[MsgPos];
txtup:=uptext;
txtbold:=bold;
txtuline:=underlined;
txtit:=italic;
txtsize:=size;
V := [];
ThreadSafeCall('LoadMsgBoxForm', V);
V := [];
If sound then
PlaySound('C:\WINDOWS\Media\tada.wav');
ThreadSafeCall('ShowMsgBoxFormModal', V);
end;
begin
MsgBox(['hello','hi','bob','yay'],'MsgBox',15,True,True,True,200,100,True);
end.