add extended line cap configuration
This commit is contained in:
15
Pilz.UI/PaintingControl/ArrowLineCapProps.vb
Normal file
15
Pilz.UI/PaintingControl/ArrowLineCapProps.vb
Normal file
@@ -0,0 +1,15 @@
|
||||
Imports System.Drawing
|
||||
Imports System.Drawing.Drawing2D
|
||||
|
||||
Public Class ArrowLineCapProps
|
||||
Inherits LineCapProps
|
||||
|
||||
Public Property Size As New Size(10, 10)
|
||||
Public Property IsFilles As Boolean = True
|
||||
|
||||
Friend Overrides Function Configure() As LineCapConfigurationArgs
|
||||
Dim cap As New AdjustableArrowCap(Size.Width, Size.Height, IsFilles)
|
||||
Return New LineCapConfigurationArgs(cap)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -113,10 +113,21 @@ Public Class DefaultDrawMethodes
|
||||
Public Shared Sub DrawLine(e As PaintingObjectPaintEventArgs)
|
||||
Dim obj As PaintingObject = e.PaintingObject
|
||||
Dim p2 As New Pen(obj.OutlineColor, obj.OutlineThicknes) With {
|
||||
.DashStyle = obj.OutlineDashStyle,
|
||||
.StartCap = obj.LineStartCap,
|
||||
.EndCap = obj.LineEndCap
|
||||
.DashStyle = obj.OutlineDashStyle
|
||||
}
|
||||
|
||||
If obj.LineStartCap IsNot Nothing Then
|
||||
Dim args As LineCapConfigurationArgs = obj.LineStartCap.Configure
|
||||
p2.StartCap = args.LineCap
|
||||
p2.CustomStartCap = args.CustomLineCap
|
||||
End If
|
||||
|
||||
If obj.LineEndCap IsNot Nothing Then
|
||||
Dim args As LineCapConfigurationArgs = obj.LineEndCap.Configure
|
||||
p2.EndCap = args.LineCap
|
||||
p2.CustomEndCap = args.CustomLineCap
|
||||
End If
|
||||
|
||||
p2.Alignment = PenAlignment.Center
|
||||
Dim no As PointF = New PointF(e.X, e.Y)
|
||||
e.Graphics.DrawLine(p2, no, no + obj.Size)
|
||||
|
||||
13
Pilz.UI/PaintingControl/DefaultLineCapProps.vb
Normal file
13
Pilz.UI/PaintingControl/DefaultLineCapProps.vb
Normal file
@@ -0,0 +1,13 @@
|
||||
Imports System.Drawing.Drawing2D
|
||||
|
||||
Public Class DefaultLineCapProps
|
||||
Inherits LineCapProps
|
||||
|
||||
Public Property LineCap As LineCap = LineCap.Flat
|
||||
Public Property CustomLineCap As CustomLineCap = Nothing
|
||||
|
||||
Friend Overrides Function Configure() As LineCapConfigurationArgs
|
||||
Return New LineCapConfigurationArgs(LineCap, CustomLineCap)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
21
Pilz.UI/PaintingControl/LineCapConfigurationArgs.vb
Normal file
21
Pilz.UI/PaintingControl/LineCapConfigurationArgs.vb
Normal file
@@ -0,0 +1,21 @@
|
||||
Imports System.Drawing.Drawing2D
|
||||
|
||||
Public Class LineCapConfigurationArgs
|
||||
|
||||
Public ReadOnly Property LineCap As LineCap
|
||||
Public ReadOnly Property CustomLineCap As CustomLineCap
|
||||
|
||||
Public Sub New(lineCap As LineCap)
|
||||
Me.New(lineCap, Nothing)
|
||||
End Sub
|
||||
|
||||
Public Sub New(customLineCap As CustomLineCap)
|
||||
Me.New(Nothing, customLineCap)
|
||||
End Sub
|
||||
|
||||
Public Sub New(lineCap As LineCap, customLineCap As CustomLineCap)
|
||||
Me.LineCap = lineCap
|
||||
Me.CustomLineCap = customLineCap
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
7
Pilz.UI/PaintingControl/LineCapProps.vb
Normal file
7
Pilz.UI/PaintingControl/LineCapProps.vb
Normal file
@@ -0,0 +1,7 @@
|
||||
Imports System.Drawing
|
||||
|
||||
Public MustInherit Class LineCapProps
|
||||
|
||||
Friend MustOverride Function Configure() As LineCapConfigurationArgs
|
||||
|
||||
End Class
|
||||
@@ -19,8 +19,8 @@ Imports Newtonsoft.Json
|
||||
Public Property OutlineColor As Color = Color.DarkBlue
|
||||
Public Property OutlineThicknes As Single = 1
|
||||
Public Property OutlineDashStyle As DashStyle = DashStyle.Solid
|
||||
Public Property LineStartCap As LineCap = LineCap.Flat
|
||||
Public Property LineEndCap As LineCap = LineCap.Flat
|
||||
Public Property LineStartCap As LineCapProps = Nothing
|
||||
Public Property LineEndCap As LineCapProps = Nothing
|
||||
<JsonProperty>
|
||||
Private _Text As String = ""
|
||||
Public Property TextPosition As TextPosition = TextPosition.FullCenter
|
||||
|
||||
Reference in New Issue
Block a user