📄 wwcheckbox.ctl
字号:
gval = gval + (255 - 223) / 8
bval = bval + (255 - 221) / 8
If rval > 255 Then rval = 255
If gval > 255 Then gval = 255
If bval > 255 Then bval = 255
DrawLine i, Hei \ 2 - 7, i, Hei \ 2 + 7, RGB(rval, gval, bval)
Next
DrawLine 3, Hei \ 2 - 3, 7, Hei \ 2 - 7, RGB(223, 224, 210) 'cShadow
DrawLine 3, Hei \ 2 - 2, 8, Hei \ 2 - 7, RGB(223, 224, 210)
DrawLine 3, Hei \ 2 + 3, 12, Hei \ 2 - 7, RGB(239, 240, 224) 'cShadow
DrawLine 7, Hei \ 2 + 4, 14, Hei \ 2 - 1, RGB(254, 255, 243)
If m_Value = [Mixed] Then
DrawRectangle 5, Hei \ 2 - 5, 10, 10, RGB(160, 208, 160)
Else
If m_Value = [Checked] Then
mSetPixelXp RGB(31, 160, 33)
End If
End If
End If
If hasFocus = True And Len(m_Caption) <> 0 Then DrawFocusR
Case 2 'Custom
Select Case m_CustomType
Case 1 ' 渐变
DrawRectangle 1, Hei \ 2 - 6, 13, 13, m_FrameColor, True
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
ccrgb = m_FillColor
If disyellowrect = True Then
For i = -5 To 5 'Step -1 '
ccrgb = ShiftColorCustom(ccrgb, 7.5, 6.7, 2, RGB(232, 254, 255))
DrawLine 2, Hei \ 2 + i, 13, Hei \ 2 + i, ccrgb
Next
Else
For i = 5 To -5 Step -1
ccrgb = ShiftColorCustom(ccrgb, 7.5, 6.7, 2, RGB(232, 254, 255))
DrawLine 2, Hei \ 2 + i, 13, Hei \ 2 + i, ccrgb
Next
End If
If m_Value = [Checked] Then
mSetPixel 3, Hei \ 2 - 1, m_HookColor
mSetPixelForce 1, m_HookColor
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, m_HookColor
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, m_HookColor
Next
End If
If m_Value = [Mixed] Then
For ii = 3 To 11 Step 2
For i = 0 To 6 Step 2
mSetPixel ii, Hei \ 2 - 3 + i, m_FillColor
Next
Next
For ii = 4 To 10 Step 2
For i = 0 To 8 Step 2
mSetPixel ii, Hei \ 2 - 4 + i, m_FillColor
Next
Next
ccrgb = ShiftColorCustom(m_HookColor, 50, 48, 28, RGB(232, 254, 255))
mSetPixel 3, Hei \ 2 - 1, ccrgb
mSetPixelForce 1, ccrgb
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, ccrgb
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, ccrgb
Next
End If
Case 2 ' 模糊
DrawRectangle 1, Hei \ 2 - 6, 13, 13, m_FrameColor, True
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
DrawRectangle 2, Hei \ 2 - 5, 11, 11, m_FillColor, False 'True
If disyellowrect = True Then
DrawLine 1, Hei \ 2 - 6, 14, Hei \ 2 - 6, m_FillColor
DrawLine 1, Hei \ 2 - 6, 1, Hei \ 2 + 6, m_FillColor
mSetPixelTexture 8
Else
mSetPixelTexture 6
End If
If m_Value = [Checked] Then
mSetPixel 3, Hei \ 2 - 1, m_HookColor
mSetPixelForce 1, m_HookColor
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, m_HookColor
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, m_HookColor
Next
End If
If m_Value = [Mixed] Then
For ii = 3 To 11 Step 2
For i = 0 To 6 Step 2
mSetPixel ii, Hei \ 2 - 3 + i, m_FillColor
Next
Next
For ii = 4 To 10 Step 2
For i = 0 To 8 Step 2
mSetPixel ii, Hei \ 2 - 4 + i, m_FillColor
Next
Next
ccrgb = ShiftColorCustom(m_HookColor, 50, 48, 28, RGB(232, 254, 255))
mSetPixel 3, Hei \ 2 - 1, ccrgb
mSetPixelForce 1, ccrgb
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, ccrgb
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, ccrgb
Next
End If
'Case 3 ' 矩形
'Case 4 '单色
End Select
If hasFocus = True And Len(m_Caption) <> 0 Then DrawFocusR
'Case 3 'Force Standard
End Select
ElseIf curStat = 2 Then
'#@#@#@#@#@# 按钮按下 #@#@#@#@#@#
Select Case m_CheckType
Case 1
DrawRectangle 2, Hei \ 2 - 8, 16, 16, &H733C00, True
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
rval = 177 '
gval = 174 '
bval = 157 '
For i = 3 To 16 '
rval = rval + (255 - 177) / 15 '
gval = gval + (255 - 174) / 15 '
bval = bval + (255 - 157) / 15 '
If rval > 242 Then rval = 242
If gval > 239 Then gval = 239
If bval > 224 Then bval = 224
DrawLine i, Hei / 2 - 7, i, Hei / 2 + 7, RGB(rval, gval, bval)
Next
DrawLine 3, Hei \ 2 - 1, 9, Hei \ 2 - 8, RGB(177, 176, 172) 'cShadow
DrawLine 3, Hei \ 2 - 2, 8, Hei \ 2 - 8, RGB(177, 176, 172)
DrawLine 3, Hei \ 2 + 3, 13, Hei \ 2 - 8, RGB(193, 193, 191) 'cShadow
DrawLine 4, Hei \ 2 + 6, 16, Hei \ 2 - 7, RGB(208, 208, 206)
DrawLine 10, Hei \ 2 + 6, 16, Hei \ 2 - 1, RGB(239, 223, 223)
If m_Value = [Mixed] Then
DrawRectangle 5, Hei \ 2 - 5, 10, 10, RGB(32, 128, 31)
Else
If m_Value = [Checked] Then
mSetPixelXp RGB(31, 127, 30)
End If
End If
If hasFocus = True And Len(m_Caption) <> 0 Then DrawFocusR
Case 2 'custom
Select Case m_CustomType
Case 1 ' 渐变
ccrgb = ShiftColorCustom(m_FrameColor, 90, 90, 50, RGB(232, 254, 255))
DrawRectangle 1, Hei \ 2 - 6, 13, 13, ccrgb, True
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
For i = 5 To -5 Step -1 '
ccrgb = ShiftColorCustom(m_FillColor, -5, -5, -5, RGB(232, 254, 255))
DrawLine 2, Hei \ 2 + i, 13, Hei \ 2 + i, ccrgb
Next
If m_Value = [Checked] Or m_Value = [Mixed] Then
ccrgb = ShiftColorCustom(m_HookColor, 120, 110, 60, RGB(255, 255, 255))
mSetPixel 3, Hei \ 2 - 1, ccrgb
mSetPixelForce 1, ccrgb '&H0
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, ccrgb
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, ccrgb
Next
End If
Case 2 ' 模糊
ccrgb = ShiftColorCustom(m_FrameColor, 90, 90, 50, RGB(250, 250, 250))
DrawRectangle 1, Hei \ 2 - 6, 13, 13, ccrgb, True
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
ccrgb = ShiftColorCustom(m_FillColor, 15, 25, 42, RGB(240, 240, 240))
DrawRectangle 2, Hei \ 2 - 5, 11, 11, ccrgb, False
If m_Value = [Checked] Or m_Value = [Mixed] Then
ccrgb = ShiftColorCustom(m_HookColor, 120, 110, 60, RGB(255, 255, 255))
mSetPixel 3, Hei \ 2 - 1, ccrgb
mSetPixelForce 1, ccrgb '&H0
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, ccrgb
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, ccrgb
Next
End If
'Case 3 ' 矩形
'Case 4 '单色
End Select
If hasFocus = True And Len(m_Caption) <> 0 Then DrawFocusR
'Case 3 'force standard
End Select
End If
Else
'#~#~#~#~#~# DISABLED STATUS #~#~#~#~#~#
Select Case m_CheckType
Case 1
DrawRectangle 2, Hei \ 2 - 8, 16, 16, &HBFCED0, True
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
DrawRectangle 3, Hei \ 2 - 7, 14, 14, &HFFFFFF
If m_Value = [Checked] Then
mSetPixelXp RGB(208, 206, 191)
ElseIf m_Value = [Mixed] Then
DrawRectangle 5, Hei \ 2 - 5, 10, 10, RGB(208, 206, 191)
End If
Case 2
SetTextColor UserControl.hdc, &HFFFFFF
DrawText .hdc, m_Caption, -1, rc2, DT_CENTERABS
SetTextColor UserControl.hdc, ccShadow
DrawText .hdc, m_Caption, -1, rc, DT_CENTERABS
Select Case m_CustomType
Case 1, 2
DrawRectangle 1, Hei \ 2 - 6, 13, 13, RGB(102, 102, 102), True
ccrgb = RGB(191, 191, 191)
For i = 5 To -5 Step -1 '
ccrgb = ShiftColorCustom(ccrgb, 7.5, 7.5, 7.5, RGB(250, 250, 250))
DrawLine 2, Hei \ 2 + i, 13, Hei \ 2 + i, ccrgb
Next
If m_Value = [Checked] Or m_Value = [Mixed] Then
mSetPixel 3, Hei \ 2 - 1, ccShadow
mSetPixelForce 1, ccShadow
For i = 0 To 2
mSetPixel 11, Hei \ 2 - 4 + i, ccShadow
Next
For i = 0 To 1 '2
mSetPixel 12, Hei \ 2 - 4 + i, ccShadow
Next
End If
'Case 3
'Case 4
End Select
'Case 3
End Select
End If
End With
'restore focus value
hasFocus = preFocusValue
If m_BackStyle = [Transparent] Then
'transparent
With UserControl
.BackStyle = 0
.MaskColor = BackCol
Set MaskPicture = .Image
End With
Else
UserControl.BackStyle = 1
End If
Call UserControl.Refresh
End Sub
Private Sub DrawRectangle(ByVal X As Long, ByVal Y As Long, ByVal Width As Long, ByVal Height As Long, ByVal Color As Long, Optional OnlyBorder As Boolean = False)
Dim bRect As RECT
Dim hBrush As Long
Dim ret As Long
bRect.Left = X
bRect.Top = Y
bRect.Right = X + Width
bRect.Bottom = Y + Height
hBrush = CreateSolidBrush(Color)
If OnlyBorder = False Then
ret = FillRect(UserControl.hdc, bRect, hBrush)
Else
ret = FrameRect(UserControl.hdc, bRect, hBrush)
End If
ret = DeleteObject(hBrush)
End Sub
Private Sub DrawLine(ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal Color As Long)
Dim pt As POINTAPI
UserControl.ForeColor = Color
MoveToEx UserControl.hdc, X1, Y1, pt
LineTo UserControl.hdc, X2, Y2
End Sub
Private Sub mSetPixel(ByVal X As Long, ByVal Y As Long, ByVal Color As Long)
Call SetPixelV(UserControl.hdc, X, Y, Color)
End Sub
Private Sub mSetPixelXp(ByVal ColorXp As Long)
Dim i As Long
Dim Ai As Long
For Ai = 5 To 7
For i = 0 To 3
mSetPixel Ai, Hei \ 2 + (Ai - 7) + i, ColorXp
'DoEvents
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -