How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Ingo U Your Own Question
Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 755
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
44076068
Type Your Programming Question Here...
Ingo U is online now
A new question is answered every 9 seconds

Using vb.net, I'm trying to draw lines as in the out line of

Customer Question

Using vb.net, I'm trying to draw lines as in the out line of a building based on data points
If you do the following example with a line with of 48pt
objGraphics.DrawLine(pPen, 1168, 793, 1025, 938) ' Horizontal ID=111
objGraphics.DrawLine(pPen, 675, 938, 1025, 938) ' Vertical ID-113
What you get is a horizontal line with 0 deg angle and a line that is not quite vertical but connects to the horizontal line.
I need to know how to fill in the gap of where the lines connect in vb.net
Submitted: 2 years ago.
Category: Programming
Expert:  Ingo U replied 2 years ago.
Hi,
so the lines both end/connect at the same point, (1025, 938), like you want, right?
What do you mean by "fill in the gap" then?
Or is it that you want the vertical line to be perfectly vertical?
BTW, you have your comments reversed.
objGraphics.DrawLine(pPen, 675, 938, 1025, 938)
draws a horizontal line, and
objGraphics.DrawLine(pPen, 1168, 793, 1025, 938)
draws a line at what looks like a 45-degree line
If you give me a little more context and what you're trying to accomplish I'm sure I can help.
-Ingo
Customer: replied 2 years ago.
I need to send you an image of what it looks likeHow do I do that?
Expert:  Ingo U replied 2 years ago.
You can attach images to your posts here on this site, look for the paper clip icon (I think) at the top of your message box.
Or, we often use free file sharing sites like wikisend.com, very easy.
Go to www.wikisend.com and upload the file there (no need to sign up). You will then get a page that has the File ID and Download Link. Copy either the File ID or the Download Link and come back here and paste it in your reply.
Expert:  Ingo U replied 2 years ago.
I just looked at your question again and noticed I had overlooked the line width of 48! Now I see what you mean by the gap, I'm pretty sure.
You need to "artifically" extend one line (or both) so that the "corners" meet up.
Of course we can manually figure out the numbers for this particular corner, using a little geometry or just trial-and-error, but I imagine you need a more general solution? Is this a one-time thing from a set of points? An homework exercise? A general tool you need to use in other future situations with different data/geometry points?
Expert:  Ingo U replied 2 years ago.
For example, try replacing your two lines of code with these:
objGraphics.DrawLine(pPen, 1168, 793, 1025 - 7, 938 + 7)
objGraphics.DrawLine(pPen, 675, 938, 1025 + 10, 938)
Does that look like what you want?
Customer: replied 2 years ago.
Yes, thanks
Expert:  Ingo U replied 2 years ago.
OK, so how about some of the other information I mentioned? I'd like to help you with the whole thing, or is this all you needed?
In case it was, I'll mark this as my answer, but feel free to follow up if you need additional details.
Here's another trick:
objGraphics.DrawLine(pPen, 1168, 793, 1025, 938)
objGraphics.DrawLine(pPen, 675, 938, 1025, 938)
objGraphics.FillEllipse(Brushes.Yellow, 1025 - 24, 938 - 24, 48, 48)
'objGraphics.FillEllipse(Brushes.Black, 1025 - 24, 938 - 24, 48, 48)
This draws a yellow circle (ellipse in a square) at the end point where the two lines connect. Makes the corner a little rounded. Some would say that looks nicer, others wouldn't. The commented-out line above draws the circle in black so your path is connected and black throughout.
Let me know...
Expert:  Ingo U replied 2 years ago.
Hi,
just following up, were you able to use my solution?
Please feel free to post any additional questions, comments or concerns you may have regarding this issue.
If you're not yet satisfied with the result, please let me know what is missing.
I will do my best to make it right for you.
Otherwise, please don't forget to rate my service - I don't get paid for my work until your rating is received.
Regards,
Ingo U
Expert:  Ingo U replied 2 years ago.
Hi,
just following up, were you able to use my solution?
Please feel free to post any additional questions, comments or concerns you may have regarding this issue.
If you're not yet satisfied with the result, please let me know what is missing.
I will do my best to make it right for you.
Otherwise, please don't forget to rate my service - I don't get paid for my work until your rating is received.
Regards,
Ingo U

Related Programming Questions