1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
void __fastcall TfrmMain::TranslateControl(HMODULE hMod, TWinControl* Control,
char* pszCaption)
{
TControl *hChild;
for (int nCnt=0; nCnt<Control->ControlCount; nCnt++) {
hChild = Control->Controls[nCnt];
if (hChild->Tag > 0) {
if (::LoadString(hMod, hChild->Tag, pszCaption, 128)) { // TRA_LEN
if (dynamic_cast<TLabel *>(hChild))
dynamic_cast<TLabel *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
else if (dynamic_cast<TCheckBox *>(hChild))
dynamic_cast<TCheckBox *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
else if (dynamic_cast<TGroupBox *>(hChild))
dynamic_cast<TGroupBox *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
else if (dynamic_cast<TRadioButton *>(hChild))
dynamic_cast<TRadioButton *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
else if (dynamic_cast<TTabSheet *>(hChild))
dynamic_cast<TTabSheet *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
else if (dynamic_cast<TButton *>(hChild))
dynamic_cast<TButton *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
else if (dynamic_cast<TForm *>(hChild))
dynamic_cast<TForm *>(hChild)->Caption =
AnsiString(pszCaption, strlen(pszCaption));
}
if (::LoadString(hMod, hChild->Tag+1, pszCaption, 128)) { // TRA_LEN
hChild->Hint = AnsiString(pszCaption, strlen(pszCaption));
}
}
if (dynamic_cast<TWinControl *>(hChild)) {
if (dynamic_cast<TWinControl *>(hChild)->ControlCount)
TranslateControl(hMod, dynamic_cast<TWinControl *>(hChild), pszCaption);
}
}
} |
Partager