29-08-13, 11:23 AM
هذا مثال منقول يحتوي على دالة رسم المقطع الدائري
ضع Command وPictureBox ثم ضع هذا الكود
وهذه النتيجة
ضع Command وPictureBox ثم ضع هذا الكود
كود :
Option Explicit
Private Sub Command1_Click()
Call DrawPiePiece(Picture1, 100, 100, 60, 0.001, 36, QBColor(9), QBColor(9))
Call DrawPiePiece(Picture1, 100, 100, 60, 36, 55, QBColor(10), QBColor(10))
Call DrawPiePiece(Picture1, 100, 100, 60, 55, 75, QBColor(11), QBColor(11))
Call DrawPiePiece(Picture1, 100, 100, 60, 75, 99.999, QBColor(12), QBColor(12))
Call DrawPiePiece(Picture1, 250, 100, 60, 0.001, 36, vbBlack, QBColor(9))
Call DrawPiePiece(Picture1, 250, 100, 60, 36, 55, vbBlack, QBColor(10))
Call DrawPiePiece(Picture1, 250, 100, 60, 55, 75, vbBlack, QBColor(11))
Call DrawPiePiece(Picture1, 250, 100, 60, 75, 99.999, vbBlack, QBColor(12))
End Sub
Public Sub DrawPiePiece(pic As PictureBox, x As Integer, y As Integer, radius As Integer, fStart As Double, fEnd As Double, lineColor As Long, fillColor As Long)
Const PI As Double = 3.14159265359
pic.ScaleMode = vbPixels
Dim CircleEnd As Double
CircleEnd = -2 * PI
pic.fillColor = fillColor
pic.FillStyle = 0
Dim dStart As Double
Dim dEnd As Double
dStart = fStart * (CircleEnd / 100)
dEnd = fEnd * (CircleEnd / 100)
pic.Circle (x, y), radius, lineColor, dStart, dEnd
End Subوهذه النتيجة
