📄 clsbutton.cls
字号:
Dim picHDC As Long
Dim conHDC As Long
Dim BContainer As Object
Set BContainer = bPic.Container
BContainer.ScaleMode = vbPixels
bPic.ScaleMode = vbPixels
BContainer.AutoRedraw = True
bPic.AutoRedraw = True
bW = bPic.ScaleWidth - 1
bH = bPic.ScaleHeight - 1
bL = bPic.Left
bT = bPic.Top
picHDC = bPic.hdc
conHDC = BContainer.hdc
'If transparent, then copy container image as background,
If Trans = True Then
BitBlt DownDC, 0, 0, bW, bH, conHDC, bL - 1, bT - 1, vbSrcCopy
BitBlt picHDC, 0, 0, bW, bH, conHDC, bL - 1, bT - 1, vbSrcCopy
Else 'we copy the container content onto the holder image and the backcolor
ClsDOWN bPic.BackColor
End If 'Left Edge
M = 1
For i = 0 To bEdge - 1
For j = i To bH - i
sPix = Darken(GetPixel(picHDC, i, j), M * bLevel)
fPix = GetPixel(conHDC, i + bL, j + bT)
SetPixel DownDC, i, j, Blend(sPix, fPix, M)
Next j
M = M - (1 / bEdge)
Next i
For j = bEdge To bH - bEdge
SetPixel DownDC, bEdge, j, Darken(GetPixel(picHDC, bEdge, j), bLevel)
Next j
'Top Edge
M = 1
For i = 0 To bEdge - 1
For j = i To bW - i
sPix = Darken(GetPixel(picHDC, j, i), M * bLevel)
fPix = GetPixel(conHDC, j + bL, i + bT)
SetPixel DownDC, j, i, Blend(sPix, fPix, M)
Next j
M = M - (1 / bEdge)
Next i
For j = bEdge To bW - bEdge
SetPixel DownDC, j, i, Darken(GetPixel(picHDC, j, bEdge), bLevel)
Next j
'Right Edge
M = 0
For i = (bW - bEdge) + 1 To bW
For j = bW - i To bH - (bW - i)
sPix = Brighten(GetPixel(picHDC, i, j), M * bLevel)
fPix = GetPixel(conHDC, i + bL, j + bT)
SetPixel DownDC, i, j, Blend(sPix, fPix, M)
Next j
M = M + (1 / bEdge)
Next i
For j = bEdge To bH - bEdge
SetPixel DownDC, (bW - bEdge), j, Brighten(GetPixel(picHDC, (bW - bEdge), j), bLevel)
Next j
'Bottom Edge
M = 0
For i = (bH - bEdge) + 1 To bH
For j = bH - i To bW - (bH - i)
sPix = Brighten(GetPixel(picHDC, j, i), M * bLevel)
fPix = GetPixel(conHDC, j + bL, i + bT)
SetPixel DownDC, j, i, Blend(sPix, fPix, M)
Next j
M = M + (1 / bEdge)
Next i
For j = bEdge To bW - bEdge
SetPixel DownDC, j, (bH - bEdge), Brighten(GetPixel(picHDC, j, (bH - bEdge)), bLevel)
Next j
Set BContainer = Nothing
End Sub
Private Sub RaiseRound(bPic As PictureBox, bLevel As Single, bEdge As Integer, bRad As Integer, Trans As Boolean)
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim bW As Integer
Dim bH As Integer
Dim bL As Integer
Dim bT As Integer
Dim sPix As Long
Dim fPix As Long
Dim M As Single
Dim S As Single
Dim picHDC As Long
Dim conHDC As Long
Dim BContainer As Object
Dim pi
pi = 4 * Atn(1)
Set BContainer = bPic.Container
Set BContainer = bPic.Container
BContainer.ScaleMode = vbPixels
bPic.ScaleMode = vbPixels
BContainer.AutoRedraw = True
bPic.AutoRedraw = True
bW = bPic.ScaleWidth - 1
bH = bPic.ScaleHeight - 1
bL = bPic.Left
bT = bPic.Top
picHDC = bPic.hdc
conHDC = BContainer.hdc
'If transparent, then copy container image as background,
If Trans = True Then
BitBlt UpDC, 0, 0, bW, bH, conHDC, bL + 1, bT + 1, vbSrcCopy
BitBlt picHDC, 0, 0, bW, bH, conHDC, bL + 1, bT + 1, vbSrcCopy
Else 'we copy the container content onto the holder image and the backcolor
ClsUP bPic.BackColor
End If
'Left Edge
'GoTo Corners
M = 1
For i = 0 To bEdge - 1
For j = (bRad + bEdge) To bH - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, i, j), M * bLevel)
fPix = GetPixel(conHDC, i + bL, j + bT)
SetPixel UpDC, i, j, Blend(sPix, fPix, M)
Next j
M = M - (1 / bEdge)
Next i
For j = (bRad + bEdge) To bH - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, bEdge, j), bLevel)
SetPixel UpDC, bEdge, j, sPix
Next j
'Top Edge
M = 1
For i = 0 To bEdge - 1
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, j, i), M * bLevel)
fPix = GetPixel(conHDC, j + bL, i + bT)
SetPixel UpDC, j, i, Blend(sPix, fPix, M)
Next j
M = M - (1 / bEdge)
Next i
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, j, bEdge), bLevel)
SetPixel UpDC, j, bEdge, sPix
Next j
'Right Edge
M = 0
For i = (bW - bEdge) + 1 To bW
For j = bRad + bEdge To bH - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, i, j), M * bLevel)
fPix = GetPixel(conHDC, i + bL, j + bT)
SetPixel UpDC, i, j, Blend(sPix, fPix, M)
Next j
M = M + (1 / bEdge)
Next i
For j = bRad + bEdge To bH - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, (bW - bEdge), j), bLevel)
SetPixel UpDC, (bW - bEdge), j, sPix
Next j
'Bottom Edge
M = 0
For i = (bH - bEdge) + 1 To bH
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, j, i), M * bLevel)
fPix = GetPixel(conHDC, j + bL, i + bT)
SetPixel UpDC, j, i, Blend(sPix, fPix, M)
Next j
M = M + (1 / bEdge)
Next i
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, j, (bH - bEdge)), bLevel)
SetPixel UpDC, j, (bH - bEdge), sPix
Next j
'--------------CORNERS-----------------------
Corners:
Dim rX As Integer
Dim rY As Integer
Dim lX As Integer
Dim lY As Integer
Dim rStep As Integer
'Top Left Corder
M = 0
For i = bRad To bRad + bEdge
For j = 91 To 179
rX = (i * Cos(j * (pi / 180))) + (bRad + bEdge)
rY = -(i * Sin(j * (pi / 180))) + (bRad + bEdge)
If lX <> rX Or lY <> rY Then
If i = bRad Then
sPix = Brighten(GetPixel(picHDC, rX, rY), bLevel)
Else
sPix = Brighten(GetPixel(picHDC, rX, rY), M * bLevel)
End If
fPix = GetPixel(conHDC, rX + bL, rY + bT)
SetPixel UpDC, rX, rY, Blend(sPix, fPix, M)
End If
lX = rX
lY = rY
Next j
M = M + (1 / (bEdge))
Next i
'Top Right Corder
M = 0
For i = bRad To bRad + bEdge
S = 0
For j = 91 To 179
rX = -(i * Cos(j * (pi / 180))) + (bW - bRad - bEdge)
rY = -(i * Sin(j * (pi / 180))) + (bRad + bEdge)
If lX <> rX Or lY <> rY Then
If j < 135 Then
If i = bRad Then
sPix = Brighten(GetPixel(picHDC, rX, rY), (1 - S) * bLevel)
Else
sPix = Brighten(GetPixel(picHDC, rX, rY), (M - S) * bLevel)
End If
Else
If i = bRad Then
sPix = Darken(GetPixel(picHDC, rX, rY), (1 - S) * bLevel)
Else
sPix = Darken(GetPixel(picHDC, rX, rY), (M - S) * bLevel)
End If
End If
fPix = GetPixel(conHDC, rX + bL, rY + bT)
SetPixel UpDC, rX, rY, Blend(sPix, fPix, M)
End If
If j < 135 Then
S = S + (1 / 45)
Else
S = S - (1 / 45)
End If
lX = rX
lY = rY
Next j
M = M + (1 / (bEdge))
Next i
'Bottom Left Corder
M = 0
For i = bRad To bRad + bEdge
S = 0
For j = 91 To 179
rX = (i * Cos(j * (pi / 180))) + (bRad + bEdge)
rY = (i * Sin(j * (pi / 180))) + (bH - bRad - bEdge)
If lX <> rX Or lY <> rY Then
If j > 135 Then
If i = bRad Then
sPix = Brighten(GetPixel(picHDC, rX, rY), (1 + S) * bLevel)
Else
sPix = Brighten(GetPixel(picHDC, rX, rY), (M + S) * bLevel)
End If
Else
If i = bRad Then
sPix = Darken(GetPixel(picHDC, rX, rY), (1 + S) * bLevel)
Else
sPix = Darken(GetPixel(picHDC, rX, rY), (M + S) * bLevel)
End If
End If
fPix = GetPixel(conHDC, rX + bL, rY + bT)
SetPixel UpDC, rX, rY, Blend(sPix, fPix, M)
End If
lX = rX
lY = rY
If j > 135 Then
S = S + (1 / 45)
Else
S = S - (1 / 45)
End If
Next j
M = M + (1 / (bEdge))
Next i
'Bottom right Corder
M = 0
For i = bRad To bRad + bEdge
For j = 91 To 179
rX = -(i * Cos(j * (pi / 180))) + (bW - bRad - bEdge)
rY = (i * Sin(j * (pi / 180))) + (bH - bRad - bEdge)
If lX <> rX Or lY <> rY Then
If i = bRad Then
sPix = Darken(GetPixel(picHDC, rX, rY), bLevel)
Else
sPix = Darken(GetPixel(picHDC, rX, rY), M * bLevel)
End If
fPix = GetPixel(conHDC, rX + bL, rY + bT)
SetPixel UpDC, rX, rY, Blend(sPix, fPix, M)
End If
lX = rX
lY = rY
Next j
M = M + (1 / (bEdge))
Next i
Set BContainer = Nothing
End Sub
Private Sub InsetRound(bPic As PictureBox, bLevel As Single, bEdge As Integer, bRad As Integer, Trans As Boolean)
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim bW As Integer
Dim bH As Integer
Dim bL As Integer
Dim bT As Integer
Dim sPix As Long
Dim fPix As Long
Dim M As Single
Dim S As Single
Dim picHDC As Long
Dim conHDC As Long
Dim BContainer As Object
Dim pi
pi = 4 * Atn(1)
Set BContainer = bPic.Container
BContainer.ScaleMode = vbPixels
bPic.ScaleMode = vbPixels
BContainer.AutoRedraw = True
bPic.AutoRedraw = True
bW = bPic.ScaleWidth - 1
bH = bPic.ScaleHeight - 1
bL = bPic.Left
bT = bPic.Top
picHDC = bPic.hdc
conHDC = BContainer.hdc
'If transparent, then copy container image as background,
If Trans = True Then
BitBlt DownDC, 0, 0, bW, bH, conHDC, bL - 1, bT - 1, vbSrcCopy
BitBlt picHDC, 0, 0, bW, bH, conHDC, bL - 1, bT - 1, vbSrcCopy
Else 'we copy the container content onto the holder image and the backcolor
ClsDOWN bPic.BackColor
End If 'Left Edge
'GoTo Corners
M = 1
For i = 0 To bEdge - 1
For j = (bRad + bEdge) To bH - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, i, j), M * bLevel)
fPix = GetPixel(conHDC, i + bL, j + bT)
SetPixel DownDC, i, j, Blend(sPix, fPix, M)
Next j
M = M - (1 / bEdge)
Next i
For j = (bRad + bEdge) To bH - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, bEdge, j), bLevel)
SetPixel DownDC, bEdge, j, sPix
Next j
'Top Edge
M = 1
For i = 0 To bEdge - 1
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, j, i), M * bLevel)
fPix = GetPixel(conHDC, j + bL, i + bT)
SetPixel DownDC, j, i, Blend(sPix, fPix, M)
Next j
M = M - (1 / bEdge)
Next i
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Darken(GetPixel(picHDC, j, bEdge), bLevel)
SetPixel DownDC, j, bEdge, sPix
Next j
'Right Edge
M = 0
For i = (bW - bEdge) + 1 To bW
For j = bRad + bEdge To bH - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, i, j), M * bLevel)
fPix = GetPixel(conHDC, i + bL, j + bT)
SetPixel DownDC, i, j, Blend(sPix, fPix, M)
Next j
M = M + (1 / bEdge)
Next i
For j = bRad + bEdge To bH - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, (bW - bEdge), j), bLevel)
SetPixel DownDC, (bW - bEdge), j, sPix
Next j
'Bottom Edge
M = 0
For i = (bH - bEdge) + 1 To bH
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, j, i), M * bLevel)
fPix = GetPixel(conHDC, j + bL, i + bT)
SetPixel DownDC, j, i, Blend(sPix, fPix, M)
Next j
M = M + (1 / bEdge)
Next i
For j = bRad + bEdge To bW - (bRad + bEdge)
sPix = Brighten(GetPixel(picHDC, j, (bH - bEdge)), bLevel)
SetPixel DownDC, j, (bH - bEdge), sPix
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -