'网上的一段代码.怎样用vb在屏幕上显示一行倾斜的字符串Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Const LF_FACESIZE = 32 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(LF_FACESIZE) As Byte End TypePrivate Sub Form_Load() Dim RotateMe As LOGFONT Me.AutoRedraw = True '角度 Deg = 290 '大小 Size = 20 '旋转 RotateMe.lfEscapement = Deg * 10 '高度 RotateMe.lfHeight = (Size * -20) / Screen.TwipsPerPixelY '建立字体 rFont = CreateFontIndirect(RotateMe) Curent = SelectObject(Me.hdc, rFont) '显示 Me.CurrentX = 500 Me.CurrentY = 200 Me.Print "在屏幕上显示一行倾斜的字符串" End Sub
别人的程序好象很简单,没有怎么复杂好象对应的替换一下就可以了,是否采用UNICODE中的字符?
也可以. 例如:将在字段名称前加上一个"@"号即可. 例如: Option ExplicitPrivate Sub Form_Load() Picture1.AutoRedraw = True Picture1.Font.Name = "@" & Picture1.Font.Name Picture1.CurrentX = 100 Picture1.CurrentY = 100 Picture1.ForeColor = RGB(255, 0, 0) Picture1.Print "中国" End Sub
'网上的一段代码.怎样用vb在屏幕上显示一行倾斜的字符串Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Const LF_FACESIZE = 32
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(LF_FACESIZE) As Byte
End TypePrivate Sub Form_Load()
Dim RotateMe As LOGFONT
Me.AutoRedraw = True
'角度
Deg = 290
'大小
Size = 20
'旋转
RotateMe.lfEscapement = Deg * 10
'高度
RotateMe.lfHeight = (Size * -20) / Screen.TwipsPerPixelY
'建立字体
rFont = CreateFontIndirect(RotateMe)
Curent = SelectObject(Me.hdc, rFont)
'显示
Me.CurrentX = 500
Me.CurrentY = 200
Me.Print "在屏幕上显示一行倾斜的字符串"
End Sub
例如:将在字段名称前加上一个"@"号即可.
例如:
Option ExplicitPrivate Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Font.Name = "@" & Picture1.Font.Name
Picture1.CurrentX = 100
Picture1.CurrentY = 100
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "中国"
End Sub