API函数

qiang268 2005-01-24 09:33:48
大家好,我有一个小问题,我在用API函数CreateFontIndirectj时,它总是提示溢出,请问是怎么回事
...全文
116 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxjlz 2005-01-24
  • 打赏
  • 举报
回复
ding
pcwak 2005-01-24
  • 打赏
  • 举报
回复
'In general section
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 Type
'In form
Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net

Dim RotateMe As LOGFONT
'Set graphic-mode to 'persistent graphic'
Me.AutoRedraw = True
'Rotate degrees
Deg = 270
'Size (in points)
Size = 20
'Set the rotation degree
RotateMe.lfEscapement = Deg * 10
'Set the height of the font
RotateMe.lfHeight = (Size * -20) / Screen.TwipsPerPixelY
'Create the font
rFont = CreateFontIndirect(RotateMe)
'Select the font n the Form's device context
Curent = SelectObject(Me.hdc, rFont)
'Print some text ...
Me.CurrentX = 500
Me.CurrentY = 200
Me.Print ":-)"
End Sub

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧