注册 登录
编程论坛 VB6论坛

请问在picturebox中print 文字要求旋转怎么做

常模块 发布于 2023-03-19 12:57, 871 次点击
做一个纸盒展开图标注尺寸,但是数值(30cm)不会旋转
3 回复
#2
mrexcel2023-03-19 16:45
程序代码:
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long

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(31) As Byte
End Type

Private Sub Command1_Click()
Dim TFont As LOGFONT
Dim hOldFont As Long, hFont As Long

With TFont
.lfHeight = 32 * -20 / Screen.TwipsPerPixelY
.lfWidth = 32 * -20 / Screen.TwipsPerPixelX
.lfEscapement = 45 * 10
.lfWeight = 700
.lfCharSet = 1
End With

hFont = CreateFontIndirect(TFont)
hOldFont = SelectObject(Me.Picture1.hdc, hFont)

With Picture1
.AutoRedraw = False
.Cls
.CurrentX = .ScaleWidth / 3
.CurrentY = .ScaleHeight / 1.5
End With
Picture1.Print "30cm"

SelectObject Me.Picture1.hdc, hOldFont
DeleteObject hFont

End Sub
#3
cuituo2023-03-19 17:55
确实是只能旋转打印图片
#4
常模块2023-03-19 19:23
回复 2楼 mrexcel
懂了,谢谢大佬解答
1