?? modhsl.bas
字號(hào):
Attribute VB_Name = "modHSL"
'****************************************************************************
'人人為我,我為人人
'枕善居漢化收藏整理
'發(fā)布日期:2007/05/08
'描 述:另類自定義listview控件源碼(支持真彩色圖標(biāo))
'網(wǎng) 站:http://www.Mndsoft.com/ (VB6源碼博客)
'網(wǎng) 站:http://www.VbDnet.com/ (VB.NET源碼博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代碼別忘記給枕善居哦!
'****************************************************************************
'
'感謝您使用本站源碼,如果方便的話請(qǐng)給于本站一點(diǎn)支持,謝謝。
'
'本站物品:
'700MB容量的VB.NET源碼光盤(pán)(38元包快遞)
'支持支付寶交易:http://auction1.taobao.com/auction/0/item_detail-0db1-a8aba972995270433643e99d2e4ac592.jhtml
'也可以銀行匯款:http://www.mndsoft.com/sale/yh.png
'
'USB電腦遙控器 源碼光盤(pán)
'支持支付寶交易:http://auction1.taobao.com/auction/0/item_detail-0db1-dd4a9c3f6a5785231091b01d54af01fd.jhtml
'也可以銀行匯款:http://www.mndsoft.com/sale/yh.png
'
'如果您給于本站一點(diǎn)支持,本站將更好的利用自身優(yōu)勢(shì)為您尋找您需要的代碼!
Option Explicit
'Author: Andrew Gray
'Date: 9/10/2001 8:18:23 PM
'Link: http://abstractvb.com/code.asp?F=50&P=1&A=926
Public Type HSL
Hue As Integer
Saturation As Integer
Luminance As Integer
End Type
Public Type RGB
Red As Integer
Green As Integer
Blue As Integer
End Type
Private Const HueMAX As Long = 239
Private Const SatMAX As Long = 240
Private Const LumMAX As Long = 240
Private Const C_2_DIV_3 As Double = (2 / 3)
Private Const C_1_DIV_3 As Double = (1 / 3)
Public Function HSLtoRGB(ByVal Hue As Integer, _
ByVal Saturation As Integer, _
ByVal Luminance As Integer) As Long
Dim RetVal As RGB
Dim pHue As Double
Dim pSat As Double
Dim pLum As Double
Dim pRed As Double
Dim pGreen As Double
Dim pBlue As Double
Dim temp1 As Double
Dim temp2 As Double
Dim temp3(2) As Double
Dim N As Long
pHue = Hue / HueMAX
pSat = Saturation / SatMAX
pLum = Luminance / LumMAX
If pSat = 0 Then
pRed = pLum
pGreen = pLum
pBlue = pLum
Else
If pLum < 0.5 Then
temp2 = pLum * (1 + pSat)
Else
temp2 = pLum + pSat - pLum * pSat
End If
temp1 = 2 * pLum - temp2
temp3(0) = pHue + C_1_DIV_3
temp3(1) = pHue
temp3(2) = pHue - C_1_DIV_3
For N = 0 To 2
If temp3(N) < 0# Then
temp3(N) = temp3(N) + 1#
ElseIf temp3(N) > 1# Then
temp3(N) = temp3(N) - 1#
End If
If 6# * temp3(N) < 1# Then
temp3(N) = temp1 + (temp2 - temp1) * 6# * temp3(N)
Else
If 2# * temp3(N) < 1# Then
temp3(N) = temp2
Else
If 3# * temp3(N) < 2# Then
temp3(N) = temp1 + (temp2 - temp1) * (C_2_DIV_3 - temp3(N)) * 6#
Else
temp3(N) = temp1
End If
End If
End If
Next N
pRed = temp3(0)
pGreen = temp3(1)
pBlue = temp3(2)
End If
With RetVal
.Red = Int(pRed * 255#)
.Green = Int(pGreen * 255#)
.Blue = Int(pBlue * 255#)
If .Red < 0 Then .Red = 0
If .Green < 0 Then .Green = 0
If .Blue < 0 Then .Blue = 0
HSLtoRGB = RGB(.Red, .Green, .Blue)
End With
End Function
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -