24-04-17, 04:19 AM
(آخر تعديل لهذه المشاركة : 24-04-17, 04:21 AM {2} بواسطة silverlight.)
نفذ الكود هذا في مشروع منفصل حتي تتضح لك الفكرة
وعندما توضح لي مكان رسم السهم بالظبط
سوف أوضح لك كيف تدمج الكود الخاص بي مع الكود الخاص بك
إن أردت ان تتخلص من ذيل السهم عليك ان تجعل القيمة 0.3F = 0.7F او العكس
وعندما توضح لي مكان رسم السهم بالظبط
سوف أوضح لك كيف تدمج الكود الخاص بي مع الكود الخاص بك
إن أردت ان تتخلص من ذيل السهم عليك ان تجعل القيمة 0.3F = 0.7F او العكس
PHP كود :
Public Class Form1
Private Sub GetArrowPath(path As Drawing2D.GraphicsPath, rect As Rectangle, direction As Directions)
Dim rectF As RectangleF = RectangleF.Inflate(rect, -4.0F, -4.0F)
Dim x As Single = (rectF.X + rectF.Width / 2.0F)
Dim y As Single = (rectF.Y + rectF.Height / 2.0F)
path.StartFigure()
path.AddLines(New PointF() {
New PointF(x, rectF.Top),
New PointF(rectF.Right, (rectF.Y + rectF.Height * 0.7F)),
New PointF((rectF.X + rectF.Width * 0.7F), (rectF.Y + rectF.Height * 0.7F)),
New PointF((rectF.X + rectF.Width * 0.7F), rectF.Bottom),
New PointF((rectF.X + rectF.Width * 0.3F), rectF.Bottom),
New PointF((rectF.X + rectF.Width * 0.3F), (rectF.Y + rectF.Height * 0.7F)),
New PointF(rectF.Left, (rectF.Y + rectF.Height * 0.7F))})
path.CloseAllFigures()
Dim matrix As Drawing2D.Matrix = New Drawing2D.Matrix()
Select Case direction
Case Directions.East
matrix.RotateAt(90.0F, New PointF(x, y))
Case Directions.South
matrix.RotateAt(180.0F, New PointF(x, y))
Case Directions.West
matrix.RotateAt(270.0F, New PointF(x, y))
End Select
path.Transform(matrix)
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
e.Graphics.SmoothingMode =Drawing2D.SmoothingMode.AntiAlias
Dim r As Rectangle = New Rectangle(10, 10, 100, 100)
Dim p As Drawing2D.GraphicsPath = New Drawing2D.GraphicsPath
GetArrowPath(p, r, Directions.East)
Using sb As New SolidBrush(Color.Black)
e.Graphics.FillPath(sb, p)
End Using
End Sub
Public Enum Directions
North
East
South
West
End Enum
End Class

