Конкретно хотелось бы градиент в виде арки , но не знаю как сделать
Помогите плиз люди добрые
Option Explicit
Private Declare Function CombineRgn Lib "gdi32.dll" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32.dll" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function GradientFill Lib "msimg32" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As Any, ByVal dwNumMesh As Long, ByVal dwMode As Long) As Long
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
Private Const GRADIENT_FILL_RECT_H As Long = &H0
Private Const RGN_COPY As Long = 5
Private Const RGN_OR As Long = 2
Private Function LongToUShort(Unsigned As Long) As Integer
LongToUShort = CInt(Unsigned - &H10000)
End Function
Private Sub Form_Load()
Dim vert(0 To 1) As TRIVERTEX
Dim gRect As GRADIENT_RECT
Dim r As Long, r2 As Long
Me.ScaleMode = vbPixels
Me.AutoRedraw = True
r = CreateEllipticRgn(10, 10, 50, 50)
r2 = CreateRectRgn(10, 30, 50, 100)
CombineRgn r, r, r2, RGN_OR
DeleteObject r2
SelectClipRgn Me.hdc, r
DeleteObject r
'from black
With vert(0)
.x = 10
.y = 10
.Red = 0
.Green = 0
.Blue = 0
.Alpha = 0
End With
'to blue
With vert(1)
.x = 50
.y = 100
.Red = 0
.Green = 0
.Blue = LongToUShort(&HFF00&)
.Alpha = 0
End With
gRect.UpperLeft = 0
gRect.LowerRight = 1
GradientFill Me.hdc, vert(LBound(vert)), 2, gRect, 1, GRADIENT_FILL_RECT_H
SelectClipRgn Me.hdc, 0
Me.Refresh
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 139