pazahr
جمعه 06 آبان 1384, 11:52 صبح
سلام.
چطور میشه مسیج باکس ها رو کاملا فارسی کرد ؟ تا چه حد اینکار امکان داره ؟ مثلا ایکون - به جای yes و no : بله خیر - کپشن دست راست و ...
( email : pazahr2002@yahoo.com )
sasan_vm
جمعه 06 آبان 1384, 13:15 عصر
سلام
این کار 100% عملی است فقط برای تبدیل ان به دلفی دست خودتان را میبوسد. :چشمک:
int __fastcall MsgDlg(const AnsiString Msg, TMsgDlgType DlgType, TMsgDlgButtons Buttons, int HelpCtx)
{
// variables that use in function
TForm * dlg; // Store dialog box
TButton * btn; // Dynamic cast use for items in dialog
int mResult, Idx, uId; // ModalResult from dialog box
static const char * BtnCaption [] = { // constant labels buttons and name
"بله", "Yes",
"نه", "No",
"تائید", "OK",
"لغو", "Cancel",
"خاتمه", "Abort",
"دوباره", "Retry",
"صرفنظر", "Ignore",
"همه", "All",
"همه نه", "NotoAll",
"همه بله", "YestoAll",
"راهنما", "Help",
NULL
};
// Start block of code
__try
{
dlg = CreateMessageDialog(Msg, DlgType, Buttons);
dlg->HelpContext = HelpCtx;
dlg->BiDiMode = bdRightToLeft;
dlg->Position = dlg->Parent ? poOwnerFormCenter : poScreenCenter;
dlg->Font->Assign(Application->MainForm->Font);
switch (DlgType)
{
case mtWarning: dlg->Caption = "اخطار";
uId = MB_ICONASTERISK; break;
case mtError: dlg->Caption = "خطا";
uId = MB_ICONHAND; break;
case mtInformation: dlg->Caption = "اطلاعات";
uId = MB_ICONEXCLAMATION; break;
case mtConfirmation: dlg->Caption = "پرسش";
uId = MB_ICONQUESTION; break;
case mtCustom: dlg->Caption = Application->Title;
uId = MB_OK;
}
// change buttons caption and right to left order
for (Idx = 1; Idx <= 21; Idx += 2)
{
btn = dynamic_cast <TButton *> (dlg->FindComponent(BtnCaption[Idx]));
if (btn)
{
btn->Caption = BtnCaption[Idx-1];
btn->Left = dlg->ClientWidth - btn->Width - btn->Left;
}
}
// change icon & message and right to left order
TLabel * Txt = dynamic_cast <TLabel *>(dlg->FindComponent("Message"));
if (Txt)
{
Txt->Left = dlg->ClientWidth - Txt->Width - Txt->Left;
Txt->Transparent = true;
}
TImage * Img = dynamic_cast <TImage *>(dlg->FindComponent("Image"));
if (Img)
{
Img->Left = dlg->ClientWidth - Img->Width - Img->Left;
}
MessageBeep(uId);
mResult = dlg->ShowModal();
}
__finally
{
delete dlg;
}
return mResult;
}
seaman202008
جمعه 06 آبان 1384, 21:03 عصر
از راهنمایی شما ممنون
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.