Private Type POINTAPI x As Long Y As Long End Type
Private Declare Function SetPixel& Lib "gdi32" (ByVal hDC As Long, _ ByVal x As Long, ByVal Y As Long, ByVal crColor As Long) Private Declare Function LineTo& Lib "gdi32" (ByVal hDC As Long, _ ByVal x As Long, ByVal Y As Long) Private Declare Function MoveToEx Lib "gdi32" (ByVal hDC As Long, _ ByVal x As Long, ByVal Y As Long, lpPoint As POINTAPI) As Long
Sub DrawHighliteGradientFrame(FormIn As Form, ByVal HiLiteCol As Long, _ ByVal ShadowCol As Long, ByVal Steps As Integer) If FormIn.WindowState = vbMinimized Then Exit Sub Dim InnerCol As Long Dim R_Inner As Long, G_Inner As Long, B_Inner As Long Dim R_HiLite As Long, G_HiLite As Long, B_HiLite As Long Dim R_Shadow As Long, G_Shadow As Long, B_Shadow As Long Dim R_HiLiteIncr As Single, G_HiLiteIncr As Single, B_HiLiteIncr As Single, Dim R_HiLiteCur As Single, G_HiLiteCur As Single, B_HiLiteCur As Single Dim R_ShadowIncr As Single, G_ShadowIncr As Single, B_ShadowIncr As Single, Dim R_ShadowCur As Single, G_ShadowCur As Single, B_ShadowCur As Single Dim sTemp As String, i As Integer, WD As Long, HT As Long, DC As Long Dim pos As Integer, LP As POINTAPI, LongVal As Long Dim oldScaleMode As Integer, oldForeColor As Long oldForeColor = FormIn.ForeColor oldScaleMode = FormIn.ScaleMode FormIn.ScaleMode = vbPixels With FormIn WD = .ScaleWidth - 1 HT = .ScaleHeight - 1 DC = .hDC End With R_HiLite = (HiLiteCol And &HFF&) G_HiLite = (HiLiteCol And &HFF00&) / &H100& B_HiLite = (HiLiteCol And &HFF0000) / &H10000 R_Shadow = (ShadowCol And &HFF&) G_Shadow = (ShadowCol And &HFF00&) / &H100& B_Shadow = (ShadowCol And &HFF0000) / &H10000 InnerCol = FormIn.BackColor R_Inner = (InnerCol And &HFF&) G_Inner = (InnerCol And &HFF00&) / &H100& B_Inner = (InnerCol And &HFF0000) / &H10000 R_HiLiteIncr = (R_HiLite - R_Inner) / Steps G_HiLiteIncr = (G_HiLite - G_Inner) / Steps B_HiLiteIncr = (B_HiLite - B_Inner) / Steps R_ShadowIncr = (R_Shadow - R_Inner) / Steps G_ShadowIncr = (G_Shadow - G_Inner) / Steps B_ShadowIncr = (B_Shadow - B_Inner) / Steps R_HiLiteCur = R_HiLite G_HiLiteCur = G_HiLite B_HiLiteCur = B_HiLite R_ShadowCur = R_Shadow G_ShadowCur = G_Shadow B_ShadowCur = B_Shadow With FormIn For i = 0 To Steps - 1 LongVal = (Int(B_HiLiteCur) * 65536) + (Int(G_HiLiteCur) * 256) + _ Int(R_HiLiteCur) .ForeColor = LongVal MoveToEx DC, i, HT - i, LP LineTo DC, i, i MoveToEx DC, i, i, LP LineTo DC, WD - i, i LongVal = (Int(B_ShadowCur) * 65536) + (Int(G_ShadowCur) * 256) + _ Int(R_ShadowCur) .ForeColor = LongVal MoveToEx DC, WD - i, i, LP LineTo DC, WD - i, HT - i MoveToEx DC, WD - i, HT - i, LP LineTo DC, i, HT - i R_HiLiteCur = R_HiLiteCur - R_HiLiteIncr G_HiLiteCur = G_HiLiteCur - G_HiLiteIncr B_HiLiteCur = B_HiLiteCur - B_HiLiteIncr R_ShadowCur = R_ShadowCur - R_ShadowIncr G_ShadowCur = G_ShadowCur - G_ShadowIncr B_ShadowCur = B_ShadowCur - B_ShadowIncr Next .Refresh End With
FormIn.ForeColor = oldForeColor FormIn.ScaleMode = oldScaleMode
End Sub |