PDA

View Full Version : Tiếng việt cho form(caption) và Msgbox?



world in future
06-08-2004, 03:20
Làm sao hiển thị tiếng việt trên chỗ caption của form cũng như trong msgbox ?
Mấy vị ơi, ai biết xin chỉ dùm!
Cảm ơn trước nhé!

dnblan
06-08-2004, 04:53
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(1 To 32) As Byte
End Type

Private Type NONCLIENTMETRICS
cbSize As Long
iBorderWidth As Long
iScrollWidth As Long
iScrollHeight As Long
iCaptionWidth As Long
iCaptionHeight As Long
lfCaptionFont As LOGFONT
iSMCaptionWidth As Long
iSMCaptionHeight As Long
lfSMCaptionFont As LOGFONT
iMenuWidth As Long
iMenuHeight As Long
lfMenuFont As LOGFONT
lfStatusFont As LOGFONT
lfMessageFont As LOGFONT
End Type

Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As NONCLIENTMETRICS, ByVal fuWinIni As Long) As Long

Private Sub Combo1_Click()
Dim ncm As NONCLIENTMETRICS
Dim Orincm As NONCLIENTMETRICS
Dim Returned As Long
Dim i As Integer
ncm.cbSize = Len(ncm)
Returned = SystemParametersInfo(41, 0, ncm, 0)
Orincm = ncm
For i = 1 To Len(Combo1.Text)
ncm.lfMessageFont.lfFaceName(i) = Asc(Mid(Combo1.Text, i, 1))
ncm.lfCaptionFont.lfFaceName(i) = Asc(Mid(Combo1.Text, i, 1))
Next i
ncm.lfMessageFont.lfFaceName(i) = 0
ncm.lfCaptionFont.lfFaceName(i) = 0
Returned = SystemParametersInfo(42, 0, ncm, &H1 Or &H2)
MsgBox "Message & Caption Font Changed To " & Combo1.Text, vbOKOnly, "NILESH"
Returned = SystemParametersInfo(42, 0, Orincm, &H1 Or &H2)
MsgBox "Message & Caption Font Replaced To " & StrConv(Orincm.lfCaptionFont.lfFaceName, vbUnicode), vbOKOnly, "NILESH"
End Sub

Private Sub Form_Load()
Dim i As Integer
Show
For i = 1 To 30
Combo1.AddItem Screen.Fonts(i)
Next i
End Sub

'Sưu tầm trên mạng

dtt_vn
07-08-2004, 00:47
Đồng ý là bạn dùng phương pháp đổi font caption của Windows, nhưng sẽ không chạy ổn định trên WinXp và 2003. Bạn cứ thử với Theme đi
Theo tôi, chúng ta bỏ luôn cái caption bar, rồi tự vẽ lại (hay dùng label cũng được, viết code cho nó docking on top). Có lẽ làm vậy mới giải quyết triệt để vấn đề.
MSGBOX thì tự thiết kế mới