PDA

View Full Version : Message DLG



soroushafyouni
جمعه 02 مرداد 1383, 02:41 صبح
چگونه زمانی که می خواهیم دستور Messagedlg را بنویسیم به جای Yes / No معادله فارسی آنها را بنویسیم مانند "بله"و"خیر"

soroushafyouni
چهارشنبه 14 مرداد 1383, 14:32 عصر
کسی این سوال را نمیتواند جواب بده؟ :oops: :o :shock: :cry:

saeed_82
جمعه 16 مرداد 1383, 22:37 عصر
بگرد قبلا نوشته شده
یه کامپوننت دیالوگ به فارسی برگردانده شده

vcldeveloper
شنبه 17 مرداد 1383, 02:51 صبح
من اینو قبلا نوشتم. ببین بدردت می خوره ؟


function CustomMsg(const DlgCaption,Text:string; MsgType:TMsgDlgType; Buttons:TMsgDlgButtons):integer;
var
MsgBox : TForm;
i : byte;
CheckBox : TCheckBox;
PicWidth : integer;
begin
MsgBox := CreateMessageDialog(Text,MsgType,Buttons);
try
//Change TEXT Properties
with (MsgBox.Controls[1] as Tlabel) do
begin
Font.Name := 'Arial';
Font.Style := Font.Style + [fsBOLD];
Font.Size := 12;
WordWrap := False;
end;

//Change IMAGE Properties
with (MsgBox.Controls[0] as TImage) do
begin
//Picture.LoadFromFile('image.bmp');
Center := True;
Stretch := True;
end;

//Change Messagebox Properties
with MsgBox do
begin
// BiDiMode := bdRightToLeft;
Font.Name := 'Arial';
Font.Size := 10;
Caption := DlgCaption;
Width := (Controls[0] as TImage).Width +
(Controls[1] as Tlabel).Width + 60;
end;

//Make a new component in the MsgBox
CheckBox := TCheckBox.Create(MsgBox);
CheckBox.Parent := MsgBox;
CheckBox.Caption := 'باکس آزمایشی';
CheckBox.BiDiMode := bdRightToLeft;
CheckBox.Left := MsgBox.Width - CheckBox.Width - 40;
CheckBox.Top := (MsgBox.Controls[3] as TButton).Top - 25;
CheckBox.Visible := True;

//Change Buttons' caption
for i := 0 to MsgBox.ControlCount-1 do
if (MsgBox.Controls[i] is TButton) then
with (MsgBox.Controls[i] as TButton) do
begin
if (UpperCase(Caption) = '&OK') then Caption := 'تایید'
else if (UpperCase(Caption) = '&YES') then Caption := 'بلی'
else if (UpperCase(Caption) = '&NO') then Caption := 'خیر'
else if (UpperCase(Caption) = 'CANCEL') then Caption := 'انصراف'
else if (UpperCase(Caption) = '&ABORT') then Caption := 'لغو'
else if (UpperCase(Caption) = '&RETRY') then Caption := 'دوباره'
else if (UpperCase(Caption) = '&IGNORE') then Caption := 'رد'
else if (UpperCase(Caption) = '&ALL') then Caption := 'همه'
else if (UpperCase(Caption) = 'N&O TO ALL') then Caption := 'خیر به همه'
else if (UpperCase(Caption) = 'YES TO &ALL') then Caption := 'بلی به همه'
else Caption := 'راهنما';
end; {with}
Result := MsgBox.ShowModal;
finally
MsgBox.Free;
end; {try}
end;

soroushafyouni
چهارشنبه 25 شهریور 1383, 16:55 عصر
:kiss: :kiss: