'==========frmApp==========
'我的EasyRGB的VB源代码,为了做网页,我写过好几次这个小工具。
'现在终于找到了我认为是最简捷的算法了
:)'Visual Basic 6.0;Windows 2000/XP
Dim strTemp
Dim strTempLeft, strTempRight As String
Dim strRed, strGreen, strBlue As String
Private Sub cmdAbout_Click()
frmAbout.Show
End Sub
Private Sub cmdClose_Click()
End
End Sub
Private Sub Form_Load()
With picApp
.Top = 0
.Left = 0
.Width = frmApp.Width
End With
picApp.BackColor = RGB(0, 0, 0)
End Sub
Private Sub hscBlue_Change()
txtBlue.Text = hscBlue.Value
picApp.BackColor = RGB(hscRed.Value, hscGreen.Value, hscBlue.Value)
Call OctToHex(hscBlue.Value)
strBlue = strTempLeft + strTempRight
txtHexBlue.Text = strBlue
End Sub
Private Sub hscBlue_Scroll()
Call hscBlue_Change
End Sub
Private Sub hscGreen_Change()
txtGreen.Text = hscGreen.Value
picApp.BackColor = RGB(hscRed.Value, hscGreen.Value, hscBlue.Value)
Call OctToHex(hscGreen.Value)
strGreen = strTempLeft + strTempRight
txtHexGreen.Text = strGreen
End Sub
Private Sub hscGreen_Scroll()
Call hscGreen_Change
End Sub
Private Sub hscRed_Change()
txtRed.Text = hscRed.Value
picApp.BackColor = RGB(hscRed.Value, hscGreen.Value, hscBlue.Value)
Call OctToHex(hscRed.Value)
strRed = strTempLeft + strTempRight
txtHexRed.Text = strRed
End Sub
Private Sub OctToHex(ByVal intOct As Integer)
Dim intHexLeft, intHexRight As Integer
Dim strHexLeft, strHexRight As String
intHexLeft = intOct \ 16
intHexRight = intOct - intHexLeft * 16
Call OctValueToHexString(intHexLeft)
strHexLeft = strTemp
strTempLeft = strHexLeft
Call OctValueToHexString(intHexRight)
strHexRight = strTemp
strTempRight = strHexRight
End Sub
Private Sub OctValueToHexString(ByVal intOctValue As Integer)
Dim strHexString
Select Case intOctValue
Case 0
strHexString = "0"
Case 1
strHexString = "1"
Case 2
strHexString = "2"
Case 3
strHexString = "3"
Case 4
strHexString = "4"
Case 5
strHexString = "5"
Case 6
strHexString = "6"
Case 7
strHexString = "7"
Case 8
strHexString = "8"
Case 9
strHexString = "9"
Case 10
strHexString = "A"
Case 11
strHexString = "B"
Case 12
strHexString = "C"
Case 13
strHexString = "D"
Case 14
strHexString = "E"
Case 15
strHexString = "F"
End Select
strTemp = strHexString
End Sub
Private Sub hscRed_Scroll()
Call hscRed_Change
End Sub
'==========Over=========
运行时截图: