Attribute VB_Name = "DispAuthor"
' DispAuthor.bas
'
' By Herman Liu
'
Option Explicit

Declare Function CreateFontIndirect Lib "gdi32" Alias _
       "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long

Type LOGFONT
    lfHeight As Long                           ' Known as em height, in logical units
    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 * 33                  ' L_FACESIZE
End Type

Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, _
    ByVal hObject As Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long

' In order for Windows NT to work
Declare Function SetGraphicsMode Lib "gdi32" (ByVal hdc As Long, ByVal iMode As Long) As Long
Const GM_ADVANCED = 2



Sub DispOrigAuthor(inObj As Object)
    On Error Resume Next
    Dim L As LOGFONT
    Dim mFont As Long
    Dim mPrevFont As Long
    Dim i As Integer
    Dim origMode As Integer
    Dim x As Single, y As Single
    Dim tmpX As Single, tmpY As Single
    Dim mresult
     ' For Windows NT to work
    mresult = SetGraphicsMode(inObj.hdc, GM_ADVANCED)
    origMode = inObj.ScaleMode
    inObj.ScaleMode = vbPixels
    
    L.lfFaceName = "Areial" & Chr$(0)
     ' L.lfEscapement = 90 * 10
    L.lfEscapement = 0
    L.lfHeight = 6 * -20 / Screen.TwipsPerPixelY
       
    mFont = CreateFontIndirect(L)
    mPrevFont = SelectObject(inObj.hdc, mFont)
    
    x = inObj.ScaleLeft + 6
    y = inObj.ScaleHeight - 13
    inObj.CurrentX = x
    inObj.CurrentY = y
    tmpX = x
    tmpY = y
    
    inObj.ForeColor = &H808080
    tmpX = tmpX + 1: tmpY = tmpY + 1
    inObj.CurrentX = tmpX
    inObj.CurrentY = tmpY
    inObj.Print "By Herman Liu"
            
    inObj.CurrentX = x
    inObj.CurrentY = y
    tmpX = x
    tmpY = y
    inObj.ForeColor = vbWhite
    tmpX = tmpX - 1: tmpY = tmpY - 1
    inObj.CurrentX = tmpX
    inObj.CurrentY = tmpY
    inObj.Print "By Herman Liu"
            
    inObj.CurrentX = x
    inObj.CurrentY = y
    inObj.ForeColor = vbBlack
    inObj.Print "By Herman Liu"
            
    mresult = SelectObject(inObj.hdc, mPrevFont)
    mresult = DeleteObject(mFont)
    inObj.ScaleMode = origMode
End Sub


