|
Создать Gradient-форму (с использованием API) |
|
|
Добавьте 2 CommandButton Private Type TRIVERTEX
x As Long
y As Long
Red As Integer
Green As Integer
Blue As Integer
Alpha As Integer
End Type
Private Type GRADIENT_RECT
UpperLeft As Long
LowerRight As Long
End Type
Const GRADIENT_FILL_RECT_H As Long = &H0
Const GRADIENT_FILL_RECT_V As Long = &H1
Private Declare Function GradientFillRect Lib "msimg32" Alias
"GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As
Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
Private Sub Form_Load()
Me.ScaleMode = vbPixels
End Sub
Private Function LongToUShort(ULong As Long) As Integer
LongToUShort = CInt(ULong - &H10000)
End Function
Private Function UShortToLong(Ushort As Integer) As Long
UShortToLong = (CLng(Ushort) And &HFFFF&)
End Function
Private Sub Command2_Click()
Cls
End Sub
Private Sub Command1_Click()
Dim vert(1) As TRIVERTEX
Dim gRect As GRADIENT_RECT
With vert(0)
.x = 0
.y = 0
.Red = 0&
.Green = &HFF&
.Blue = 0&
.Alpha = 0&
End With
With vert(1)
.x = Me.ScaleWidth
.y = Me.ScaleHeight
.Red = 0&
.Green = LongToUShort(&HFF00&)
.Blue = LongToUShort(&HFF00&)
.Alpha = 0&
End With
gRect.UpperLeft = 1
gRect.LowerRight = 0
'Замените GRADIENT_FILL_RECT_H на GRADIENT_FILL_RECT_V чтобы
рисовать вертикальную прорисовку
GradientFillRect Me.hdc, vert(0), 2, gRect, 1, GRADIENT_FILL_RECT_H
End Sub
|
|
|
|
|
|
|