PDA

View Full Version : دلیل وجود محاسبه ای در API ...



mkbo_webmaster
شنبه 26 فروردین 1385, 18:18 عصر
کد زیر در مورد چگونگی عملکرد تابع CreateFontIndirect در API مثالی زده ، میخواستم بدونم آیا کسی اطلاع داره که قسمت bold شده این کد دقیقا برای چی طراحی شده ؟
متشکر



'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()

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