quanghoasla > 22-07-11, 12:58 AM
domfootwear > 22-07-11, 09:52 AM
quanghoasla > 22-07-11, 11:01 AM
domfootwear > 22-07-11, 11:20 AM
Option Compare Database
Option Explicit
Public Const SPI_GETNONCLIENTMETRICS = 41
Public Const SPI_SETNONCLIENTMETRICS = 42
Public Const SPI_GETICONTITLELOGFONT = 31
Public Const SPI_SETICONTITLELOGFONT = 34
Public Const SPIF_UPDATEINIFILE = 1
Public Const SPIF_SENDCHANGE = 2
Public Const hlfHeight = -12
Public 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 As String * 32
End Type
Public 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
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Public m_nonClientMetric As NONCLIENTMETRICS
Public m_logFont As LOGFONT
Public m_fontCaption As String * 32
Public m_sizeFontCaption As Integer
Public m_fontSmCaption As String * 32
Public m_sizeFontSmCaption As Integer
Public m_fontMenu As String * 32
Public m_sizeFontMenu As Integer
Public m_fontMessage As String * 2
Public m_sizeFontMessage As Integer
Public m_fontStatus As String * 32
Public m_sizeFontStatus As Integer
Public m_fontIcon As String * 32
Public m_sizeFontIcon As Integer
Public Sub MoFont(fontname As String)
Dim ret As Long
m_nonClientMetric.cbSize = Len(m_nonClientMetric)
ret = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, Len(m_nonClientMetric), m_nonClientMetric, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
ret = SystemParametersInfo(SPI_GETICONTITLELOGFONT, Len(m_logFont), m_logFont, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
m_fontCaption = m_nonClientMetric.lfCaptionFont.lfFaceName
m_sizeFontCaption = m_nonClientMetric.lfCaptionFont.lfHeight
m_fontSmCaption = m_nonClientMetric.lfSmCaptionFont.lfFaceName
m_sizeFontSmCaption = m_nonClientMetric.lfSmCaptionFont.lfHeight
m_fontMenu = m_nonClientMetric.lfMenuFont.lfFaceName
m_sizeFontMenu = m_nonClientMetric.lfMenuFont.lfHeight
m_fontMessage = m_nonClientMetric.lfMessageFont.lfFaceName
m_sizeFontMessage = m_nonClientMetric.lfMessageFont.lfHeight
m_fontStatus = m_nonClientMetric.lfStatusFont.lfFaceName
m_sizeFontStatus = m_nonClientMetric.lfStatusFont.lfHeight
m_fontIcon = m_logFont.lfFaceName
m_sizeFontIcon = m_logFont.lfHeight
m_nonClientMetric.lfCaptionFont.lfFaceName = fontname & vbNullChar
m_nonClientMetric.lfSmCaptionFont.lfFaceName = fontname & vbNullChar
m_nonClientMetric.lfMenuFont.lfFaceName = fontname & vbNullChar
m_nonClientMetric.lfMessageFont.lfFaceName = fontname & vbNullChar
m_nonClientMetric.lfStatusFont.lfFaceName = fontname & vbNullChar
ret = SystemParametersInfo(SPI_SETNONCLIENTMETRICS, Len(m_nonClientMetric), m_nonClientMetric, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
m_logFont.lfFaceName = fontname & vbNullChar
ret = SystemParametersInfo(SPI_SETICONTITLELOGFONT, Len(m_logFont), m_logFont, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
End Sub
Public Sub DongFont()
Dim ret As Long
m_nonClientMetric.lfCaptionFont.lfFaceName = m_fontCaption
m_nonClientMetric.lfCaptionFont.lfHeight = m_sizeFontCaption
m_nonClientMetric.lfSmCaptionFont.lfFaceName = m_fontSmCaption
m_nonClientMetric.lfSmCaptionFont.lfHeight = m_sizeFontSmCaption
m_nonClientMetric.lfMenuFont.lfFaceName = m_fontMenu
m_nonClientMetric.lfMenuFont.lfHeight = m_sizeFontMenu
m_nonClientMetric.lfMessageFont.lfFaceName = m_fontMessage
m_nonClientMetric.lfMessageFont.lfHeight = m_sizeFontMessage
m_nonClientMetric.lfStatusFont.lfFaceName = m_fontStatus
m_nonClientMetric.lfStatusFont.lfHeight = m_sizeFontStatus
ret = SystemParametersInfo(SPI_SETNONCLIENTMETRICS, Len(m_nonClientMetric), m_nonClientMetric, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
m_logFont.lfFaceName = m_fontIcon
m_logFont.lfHeight = m_sizeFontIcon
ret = SystemParametersInfo(SPI_SETICONTITLELOGFONT, Len(m_logFont), m_logFont, SPIF_UPDATEINIFILE Or SPIF_SENDCHANGE)
End Sub
Option Compare Database
Private Sub cmdInputBox_Click()
Dim strName
strName = InputBox("Tui lµ InputBox TiÕng ViÖt ®©y nÌ b¹n ¬i ", "InputBox TiÕng ViÖt ®©y nÌ")
If strName = vbNullString Then Exit Sub
MsgBox strName, vbInformation, "Xin chµo tÊt c¶ c¸c b¹n"
End Sub
Private Sub cmdMsgBox_Click()
MsgBox "§©y lµ hép tho¹i TiÕng ViÖt", vbExclamation, "Th«ng b¸o"
End Sub
Private Sub Form_Load()
MoFont ("VK Sans Serif")
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call DongFont
End Sub
quanghoasla > 22-07-11, 11:55 AM
quanghoasla > 22-07-11, 03:22 PM
domfootwear > 22-07-11, 05:36 PM
quanghoasla > 23-07-11, 01:28 PM
domfootwear > 23-07-11, 01:43 PM
(23-07-11, 01:28 PM)quanghoasla Đã viết: cái inputbox của em nếu nhập số thì ok. còn nếu nhập kiểu text" kiểu chuỗi ký tự thì bị lỗi.em muốn format input slxuat kieu number thì làm kiểu gì. mong anh/chị chỉ giáo
Private Sub cmdInputBox_Click()
Dim strName As Integer
strName = InputBox("Tui lµ InputBox TiÕng ViÖt ®©y nÌ b¹n ¬i ", "InputBox TiÕng ViÖt ®©y nÌ")
If Len(strName) = 0 Then Exit Sub
MsgBox strName, vbInformation, "Xin chµo tÊt c¶ c¸c b¹n"
End Sub
quanghoasla > 23-07-11, 01:58 PM