473,987 Members | 54,829 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 16982
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*****@discus sions.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(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint

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

p.EndCap = Drawing2D.LineC ap.ArrowAnchor

p.StartCap = Drawing2D.LineC ap.RoundAnchor

e.Graphics.Draw Line(p, 20, 20, 100, 20)

e.Graphics.Draw Line(p, 20, 20, 20, 100)

End Sub

Ken

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

"Stephen" <St*****@discus sions.microsoft .com> wrote in message
news:F7******** *************** ***********@mic rosoft.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*****@discus sions.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.ArrowAn chor, _
LineCap.Round, _
DashCap.Round _
)
e.Graphics.Draw Lines(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.Triangl e, _
LineCap.RoundAn chor, _
DashCap.Round _
)
e.Graphics.Draw Lines(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.ArrowAn chor, _
LineCap.Diamond Anchor, _
DashCap.Flat _
)
e.Graphics.Draw Lines(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
3849
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 would be highly appreciated. Best Regards RSB
1
1581
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 me to use the arrows in the down left side of the form.This arrows are built in the form and i cannot remove them. Is it possible to remove these arrows from my form and thus to force the user to use ony my navgtion arrows?
12
3509
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 through the list by dragging the scroll bar and it works fine, but if I try to use the up/down scroll bar buttons or page by clicking above or below the scroll thumb button the list does not scroll. Here's my OnDrawItem for the ListBox: ...
1
4137
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 circle in PHP? Actually for the circle I am using the imageellipse() function and it works. How do I get the description inside the circle, i.e, Circle A, Circle B, etc? Thanks heaps,
1
3101
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 maybe by simulating VB macro in Corel Draw... And this kind of solution I can have.. But I want without opening Corel Draw, using the libraries only or something like this?
3
1357
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
9224
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 program and maximize it again, the arrows dissapear :S. this also happens if I open another program on top of the program I'm creating. Is their a way to correct this? To draw the lines I've been using this piece of code.
12
2125
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 wanted to make a small diagram to depict what a piece of PHP-code does, a database relationship diagram, or, wel... But to do that in ASCII is hard, and not very much fun to do! So, I created this online app that allows you to draw simple diagrams...
1
1639
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 y axis at a indicated time living the x axis or give me a short tutorial about how to use visual basic to draw charts.
0
10395
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10204
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11691
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10145
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6480
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5234
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.