level 1
贴一下最后用饼图拼接的代码
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Bmp As New Bitmap(Pic.Width, Pic.Height)
Dim Grp As Graphics = Graphics.FromImage(Bmp)
Dim Path As New GraphicsPath
Dim Rect As New Rectangle(50, 50, 300, 300)
Dim Parts As Integer = 360
Dim i As Integer
Dim Angle As Single = 360 / Parts
Grp.SmoothingMode = SmoothingMode.AntiAlias
For i = 0 To Parts - 1
Path.Reset()
If i < Parts - 1 Then
Path.AddPie(Rect, i * Angle, Angle * 2) '此处sweepAngle应该大于等分角度,否则会有各种美丽的图案呈现
Else
Path.AddPie(Rect, i * Angle, Angle) '终点sweepAngle等于等分角度,否则转过头了就歪了
End If
Grp.FillPath(New SolidBrush(Color.FromArgb(&HFF, 255 - i * 255 / Parts, 255 - i * 255 / Parts, 255 - i * 255 / Parts)), Path)
Next
Pic.Image = Bmp
Grp.Dispose()
End Sub
2015年05月18日 16点05分
