Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Friday, October 5, 2007 8:11:07 AM(UTC)


Groups: Registered
Posts: 5

I am using leadtools 15 , in VB.Net, with document imaging annotations.

I want to use custom linecap, because the linecap.arrowanchor is too small for my customer needs.

With system.drawing.drawing2d,
one can use :
pen.startcap = linecap.custom
pen.customstartcap = mycap                                                

How to do this with AnnPen. I can set MyAnnPen.startcap=linecap.custom, but there is no AnnPen.customstartCap propertie ?



Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, October 7, 2007 1:24:49 AM(UTC)

Qasem Lubani  

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

If you would like to ask our engineers to add it as a feature, you can submit a feature request with details of what you need exactly, using the following web form:

#3 Posted : Sunday, October 7, 2007 2:49:07 AM(UTC)


Groups: Registered
Posts: 5

I thought it was possible overloading the annlineobject class. but if it is not possible,  I will deal with it.
#4 Posted : Tuesday, October 9, 2007 12:22:35 PM(UTC)


Groups: Registered
Posts: 5

I did it this way :

Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Runtime.Serialization

' LEADTOOLS namespaces
Imports Leadtools
Imports Leadtools.Annotations
Imports Leadtools.WinForms
Imports Leadtools.Codecs
Imports Leadtools.Internal

<Serializable()> _
Public Class MyAnnFlecheAbbObject : Inherits AnnLineObject ' must derive from AnnObject or one of its derived classes
    ' constructor

    Public Sub New() ' no, we do not require a font
        MyBase.New(True, True, False)
        ' initialize the points

    End Sub


    Protected Overrides Function Create() As AnnObject
        ' must return a new instance of our class
        Return New MyAnnFlecheAbbObject()
    End Function

    Public Overrides Function Clone() As Object
        ' override the clone method

        ' first call the base implementation
        Dim obj As MyAnnFlecheAbbObject = CType(IIf(TypeOf MyBase.Clone() Is MyAnnFlecheAbbObject, MyBase.Clone(), Nothing), MyAnnFlecheAbbObject)

        ' next, copy the points

        Return obj
    End Function

    Function custcap() As CustomLineCap

        Dim hPath As New GraphicsPath()
        Dim myArray As Point() = {New Point(-2, -7), New Point(2, -7), New Point(0, 0), New Point(-2, -7), New Point(-1, -7), New Point(0, 0), New Point(1, -7), New Point(0, 0), New Point(0, -7), New Point(0, 0)}
        ' Construct the hook-shaped end cap.
        Dim HookCap As New CustomLineCap(Nothing, hPath)
        ' Set the start cap and end cap of the HookCap to be rounded.
        'HookCap.SetStrokeCaps(LineCap.Triangle, LineCap.Triangle)
        HookCap.StrokeJoin = LineJoin.Bevel
        Return HookCap
    End Function

    Protected Overrides Sub DrawObject(ByVal graphics As System.Drawing.Graphics)

        Dim vpen As Pen

        Dim vs As System.Drawing.Drawing2D.GraphicsState = Me.BeginDraw(graphics)

        vpen = New Pen(Me.Pen.Color, Me.Pen.Width.Value)
        vpen.StartCap = Me.Pen.StartCap
        vpen.EndCap = Me.Pen.EndCap
        If Me.Pen.EndCap = LineCap.Custom Then
            vpen.EndCap = LineCap.Custom
            vpen.CustomEndCap = custcap()
        End If
        If Me.Pen.StartCap = LineCap.Custom Then
            vpen.StartCap = LineCap.Custom
            vpen.CustomStartCap = custcap()
        End If
        vpen.DashStyle = Me.Pen.DashStyle

        graphics.DrawPath(vpen, Me.GetGraphicsPath(AnnGetGraphicsPathMode.DrawObject))

        Me.EndDraw(graphics, vs)

    End Sub

End Class
'End Namespace

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.085 seconds.