473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to draw arrows in Visual Basic .NET

hi, i would like to draw static arrows in the window form. Seems from the
posts that there isnt any drawing toolbox.

Is there a way of doing it?

Pls go step by step, this is the first time i am programming.
Wish it was as easy as in Microsoft Word where u can just drag an arrow....
Thanks
Nov 21 '05 #1
3 16808
Stephen,

There is, you can open as a new item a bitmap. Draw on that a nice arrow.
Save that bitmap and when you do it nice, add that bitmap to an imagelist
and than use that in a control.

Almost every control has the possibility to use an image in it.

http://msdn.microsoft.com/library/de...imagetopic.asp

In some of the controls as the picturebox this is not functioning, however
with the most it goes.

I hope this helps?

Cor

"Stephen" <St*****@discussions.microsoft.com>
hi, i would like to draw static arrows in the window form. Seems from the
posts that there isnt any drawing toolbox.

Is there a way of doing it?

Pls go step by step, this is the first time i am programming.
Wish it was as easy as in Microsoft Word where u can just drag an
arrow....
Thanks

Nov 21 '05 #2
Hi,

In addition to Cor's comments you can draw a line with a endcap set
to an arrowanchor in the forms paint event.

http://msdn.microsoft.com/library/de...ndcaptopic.asp

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

Dim p As New Pen(Color.Blue, 10)

p.EndCap = Drawing2D.LineCap.ArrowAnchor

p.StartCap = Drawing2D.LineCap.RoundAnchor

e.Graphics.DrawLine(p, 20, 20, 100, 20)

e.Graphics.DrawLine(p, 20, 20, 20, 100)

End Sub

Ken

---------------------

"Stephen" <St*****@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
hi, i would like to draw static arrows in the window form. Seems from the
posts that there isnt any drawing toolbox.

Is there a way of doing it?

Pls go step by step, this is the first time i am programming.
Wish it was as easy as in Microsoft Word where u can just drag an arrow....
Thanks
Nov 21 '05 #3
"Stephen" <St*****@discussions.microsoft.com> schrieb:
hi, i would like to draw static arrows in the window form.
Seems from the posts that there isnt any drawing toolbox.

Is there a way of doing it?


\\\
Imports System.Drawing
Imports System.Drawing.Drawing2D
..
..
..

' In the form's 'Paint' event handler or 'OnPaint' method...
Dim p As New Pen(Color.Red, 14)
Dim pt1() As Point = { _
New Point(40, 40), _
New Point(120, 40), _
New Point(120, 60) _
}
p.LineJoin = LineJoin.Bevel
p.SetLineCap( _
LineCap.ArrowAnchor, _
LineCap.Round, _
DashCap.Round _
)
e.Graphics.DrawLines(p, pt1)
Dim pt2() As Point = { _
New Point(150, 90), _
New Point(150, 40), _
New Point(200, 40) _
}
p.Color = Color.Blue
p.LineJoin = LineJoin.Round
p.SetLineCap( _
LineCap.Triangle, _
LineCap.RoundAnchor, _
DashCap.Round _
)
e.Graphics.DrawLines(p, pt2)
Dim pt3() As Point = { _
New Point(280, 100), _
New Point(260, 80), _
New Point(260, 40), _
New Point(280, 40), _
New Point(280, 60), _
New Point(220, 60), _
New Point(220, 80) _
}
p.Color = Color.Black
p.LineJoin = LineJoin.Bevel
p.Width = 4
p.SetLineCap( _
LineCap.ArrowAnchor, _
LineCap.DiamondAnchor, _
DashCap.Flat _
)
e.Graphics.DrawLines(p, pt3)
p.Dispose()
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Raja | last post by:
Dear Members, Has anyone used the Vector Draw (www.vdraw.com) Component in Visual Basic. I need to create an application to be able to draw the plan view of a building. Any help in this regard...
1
by: Johm | last post by:
How can i remove the built in navigation arrows in the form ? With the help of the wizard i have built customized navigation buttons,to move to the left or to the right,but it is still posible for...
12
by: Jim H | last post by:
I have a ListBox hold a list of my custom controls (it's UserControl based control with a couple radio buttons and a checkbox). Everything works and displays the way I expected it to. I can move...
1
by: hehehewalrus | last post by:
Hi folks, I'm a newbie to doing images and graphics in PHP. I would appreciate your help in the following: 1. Is there a function to draw arrowed lines in PHP? 2. Is there a way I can label a...
1
PEB
by: PEB | last post by:
Hi all, I want to Transform slide1 of multiple CorelDrow files to respective tiff files using Visual Basic or VB scripts... Manually it can be done for each Corel Draw file... Automatically...
3
by: Benson Wong | last post by:
I would like to draw a simple flow chart including Textbox for "Process", lines and arrows for "Flow". Any hints? Benson VB2005, XP Pro, .Net 2.0.
4
by: hastalavista | last post by:
HI I'm very new to C# and I've got a big project to do in C# for uni until july. I've been trying do draw lines in C# (arrows to be precise). I can draw them allright but once I minimize the...
12
by: pwiegers | last post by:
Yes, I know, this is sort of commercial.. but how else to get people to, what I think, is a handy online applicaton? I created this app because I hate do document :) (Don't we all?) Sometimes I...
1
by: ape | last post by:
if i have the following data , x axis 10,9,8,7,6 and y axis 5,4,3,2,1. how can i use visual basic to draw a bar chart for x axis just at an indicated time living the y axis, and drawing bar chart for...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.