这个问题我百度了很久,也没查到这个函数,及函数的具体用法。
我参考画圆的函数试着声明了这样的画扇形函数
画圆的函数:Public Declare Function GdipDrawEllipseI Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, ByVal x As Long, ByVal y As Long, ByVal Width As Long, ByVal Height As Long) As GpStatus
没查到画扇形的函数,我试着凑了一个:Public Declare Function GdipDrawPie Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, ByVal x As Single, ByVal y As Single, ByVal Width As Single, ByVal Height As Single, ByVal X3 As Long, ByVal Y3 As Long) As GpStatus居然没有报错,但是,结果却画出了一个圆。
苦逼啊,有哪位高手可以求解吗?我的邮箱是chinacohit@163.COM QQ 1002031672
--------------------编程问答--------------------
不需要GDI+,是直接用GDI,画扇形,其实,就是API,画圆形,加参数,就能画扇形,半透明,用其它方法可以实现
--------------------编程问答--------------------
Public Sub 画圆(hDc As Long, ByVal 圆心X As Long, ByVal 圆心Y As Long, ByVal 宽度 As Long, ByVal 高度 As Long, _
ByVal 度起点 As Long, ByVal 度终点 As Long, ByVal 框线粗细 As Long, ByVal 线条类型 As 线条类型_m, ByVal 边框色 As Long, ByVal 填充色 As Long)
Dim pBrush As Long, pPen As Long
Dim X1 As Long, X2 As Long, X3 As Long, x4 As Long
Dim Y1 As Long, Y2 As Long, Y3 As Long, y4 As Long
Dim A As Single
If 填充色 < 0 Then
Call Arc(hDc, X1, Y1, X2, Y2, X3, Y3, x4, y4)
Else
Call Pie(hDc, X1, Y1, X2, Y2, X3, Y3, x4, y4)
End If
Call DeleteObject(SelectObject(hDc, pBrush))
Call DeleteObject(SelectObject(hDc, pPen))
End Sub
--------------------编程问答--------------------
半透明,可以先将扇形画到,P2,然后用
Public Function 半透明复制图2(ByVal 目标DC As Long, ByVal x目标 As Long, ByVal y目标 As Long, ByVal w目标 As Long, ByVal h目标 As Long, ByVal 源DC As Long, ByVal x源 As Long, ByVal y源 As Long, ByVal w源 As Long, ByVal h源 As Long, ByVal 透明度百分比 As Long) As Long
Dim lngBlend As Long
'lngBlend = Val("&h" & Hex(透明度) & "00" & "00")
lngBlend = RGB(0, 0, 255 - 2.55 * 透明度百分比)
AlphaBlending 目标DC, x目标, y目标, w目标, h目标, 源DC, x源, y源, w源, h源, lngBlend
End Function
Public Declare Function GdipDrawPieI Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, ByVal x As Long, ByVal y As Long, ByVal Width As Long, ByVal Height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
我的自己瞎拼凑的扇形声明函数
'Public Declare Function GdipDrawPie Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, ByVal x As Single, ByVal y As Single, ByVal Width As Single, ByVal Height As Single, ByVal X3 As Long, ByVal Y3 As Long) As GpStatus
Public Declare Function GdipDrawPieI Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, ByVal x As Long, ByVal y As Long, ByVal Width As Long, ByVal Height As Long, ByVal startAngle As Single, ByVal sweepAngle As Single) As GpStatus
我的自己瞎拼凑的扇形声明函数
'Public Declare Function GdipDrawPie Lib "gdiplus" (ByVal Graphics As Long, ByVal pen As Long, ByVal x As Single, ByVal y As Single, ByVal Width As Single, ByVal Height As Single, ByVal X3 As Long, ByVal Y3 As Long) As GpStatus