Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Clear Lines in the LineShape Control (Visual Studio)

$
0
0

Hi,

I use the example found here to draw lines

http://msdn.microsoft.com/en-us/library/cc488281.aspx

I have added a button to clear the lines but cannot find the proper code that clears them.

Such as

 Private Sub ClearLines_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearLines.Click
        Dim canvas As ShapeContainer


        canvas.clear()

    End Sub

The error I get is

'clear' is not a member of 'Microsoft.VisualBasic.PowerPacks.ShapeContainer'

In case this helps here is the full code, I am use 2 text boxes to set the line height and length.

There is a Draw Line Button,Close Button and clear Lines Button.

Thanks

Imports Microsoft.VisualBasic.PowerPacks
' Declare an event at module level.


Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim canvas As New ShapeContainer
        Dim theLine As New LineShape, Var1, Var2
        Dim x, y, rise, run
        var1 = Val(TxtHgt.Text)
        Var2 = Val(TxtLgth.Text)
        x = Var2 * 2
        y = Var1 * 2

        ' Set the form as the parent of the ShapeContainer.
        canvas.Parent = Me
        ' Set the ShapeContainer as the parent of the LineShape.
        theLine.Parent = canvas
        ' Set the starting and ending coordinates for the line.
    
        theLine.StartPoint = New System.Drawing.Point(0, 0)
        theLine.EndPoint = New System.Drawing.Point(x, y)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()
    End Sub

   
    Private Sub ClearLines_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearLines.Click
        Dim canvas As ShapeContainer


        canvas.clear()

    End Sub
End Class



Dave


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>