移植VB维护程序到mobile下
'=====================================================
'绘制弧形
'
' graphicsObject - Graphics 对象
' pen - 画笔
' x,y - 弧的圆心
' width - 宽度 (X直径)
' height - 高度 (Y直径)
' startAngle - 起始角度
' sweepAngle - 结束角度
'
Private Sub drawPie(ByVal graphicsObject As Graphics, ByVal pen As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal startAngle As Single, ByVal sweepAngle As Single)
Dim xAngle(12) As Single
Dim yAngle(12) As Single
Dim angleIncrement As Single
angleIncrement = (sweepAngle - startAngle) / 10
Dim angle As Single
angle = startAngle
Dim i As Integer
For i = 0 To 10
xAngle(i) = x + (Math.Cos(angle * (Math.PI / 180)) * (width / 2))
yAngle(i) = y + (Math.Sin(angle * (Math.PI / 180)) * (height / 2))
angle += angleIncrement
Next i
xAngle(11) = x + (Math.Cos(sweepAngle * (Math.PI / 180)) * (width / 2))
yAngle(11) = y + (Math.Sin(sweepAngle * (Math.PI / 180)) * (height / 2))
Dim anglePoints(12) As Point
anglePoints(0) = New Point(x, y)
For i = 0 To 11
anglePoints(i + 1) = New Point(CInt(xAngle(i)), CInt(yAngle(i)))
Next
graphicsObject.DrawPolygon(pen, anglePoints)
End Sub
'=====================================================
'填充弧形
' graphicsObject - Graphics 对象
' solidBrush - 画刷
' x,y - 弧的圆心
' width - 宽度 (X直径)
' height - 高度 (Y直径)
' startAngle - 起始角度
' sweepAngle - 结束角度
'
Sub fillPie(ByVal graphicsObject As Graphics, ByVal solidBrush As SolidBrush, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal startAngle As Single, ByVal sweepAngle As Single)
Dim xAngle(12) As Single
Dim yAngle(12) As Single
Dim angleIncrement As Single
angleIncrement = (sweepAngle - startAngle) / 10
Dim angle As Single
angle = startAngle
Dim i As Integer
For i = 0 To 10
xAngle(i) = x + (Math.Cos(angle * (Math.PI / 180)) * (width / 2))
yAngle(i) = y + (Math.Sin(angle * (Math.PI / 180)) * (height / 2))
angle += angleIncrement
Next i
xAngle(11) = x + (Math.Cos(sweepAngle * (Math.PI / 180)) * (width / 2))
yAngle(11) = y + (Math.Sin(sweepAngle * (Math.PI / 180)) * (height / 2))
Dim anglePoints(12) As Point
anglePoints(0) = New Point(x, y)
For i = 0 To 11
anglePoints(i + 1) = New Point(CInt(xAngle(i)), CInt(yAngle(i)))
Next
graphicsObject.FillPolygon(solidBrush, anglePoints)
End Sub
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)
