Solved

VB.net erase line between two points

Posted on 2012-04-03
3
414 Views
Last Modified: 2012-04-03
Hi. I use the following code to draw a line between two points on a TreeView. What code would I use to clear this line

    Sub oDrawLine()

        Dim Gr As Graphics = Me.TreeView_From.CreateGraphics()
        ' Create pen.
        Dim blackPen As New Pen(Color.DarkOrange, 2)

        ' Draw line to screen.
        Gr.DrawLine(blackPen, oFrom_Point, oTo_Point)

    End Sub
0
Comment
Question by:murbro
3 Comments
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
Comment Utility
You've used CreateGraphics(), which is a temporary drawing surface.  To erase, just Refresh() the Form/TreeView.  If you are not calling that method from the Paint() event then it will be erased for you.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
Comment Utility
Strange variable name, blackPen, for an orange line, even it is is dark orange :-)

If the line never cross anything else, simply create a DeleteLine method with the same code, but use the TreeView BackColor instead of the DarkOrange.
0
 

Author Closing Comment

by:murbro
Comment Utility
thanks very much
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now