473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Arrows

Hello,

Does anybody know how to draw arrows with C#?

regards

mathon
Jul 21 '05 #1
3 1698
I'm sure you can port this VB ;-)

Dim p As New Pen(Color.Red)
p.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor
p.EndCap = System.Drawing.Drawing2D.LineCap.Flat
p.Width = 2
Me.CreateGraphics.DrawLine(p, 200, 200, 400, 400)

Those caps are pretty small, but there is a CustomLineCap class that I
believe lets you define your own caps using a Path. I've never used the
Custom option myself, sorry.

Robert Smith
Kirkland, WA
www.smithvoice.com
"mathon" <ma****@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.com...
Hello,

Does anybody know how to draw arrows with C#?

regards

mathon

Jul 21 '05 #2
Hello,

I tried it with your code like that:

System.Drawing.Pen myPen = null;
myPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
myPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
myPen.Width = 2;
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(myPen, a, b, c, d);
myPen.Dispose();
formGraphics.Dispose();

But I always get a NullReferenceException. Does anybody know what went wrong
here?

regards

mat
Jul 21 '05 #3
= New Pen ?

"mathon" <ma****@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
Hello,

I tried it with your code like that:

System.Drawing.Pen myPen = null;
myPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
myPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
myPen.Width = 2;
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(myPen, a, b, c, d);
myPen.Dispose();
formGraphics.Dispose();

But I always get a NullReferenceException. Does anybody know what went
wrong
here?

regards

mat

Jul 21 '05 #4

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

Similar topics

4
1589
by: Jerald | last post by:
Hi. I've just installed 2.3.4 from the source on a linux box. In the interactive mode, up/down arrows do not work. When I press 'up' python prints '^[[A' and down gives '^[[B' What is wrong? ...
1
1555
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...
0
1329
by: Bamse | last post by:
Hello! is there a way to enable individual arrows in DomainUpDown Control? i want to disable up/down arrows when the current item in the control reaches certain value. Thank you, Daniel
1
7364
by: Xarky | last post by:
Hi, I would like to draw lines and lines with arrows. There position is to be either vertical or horizontal. Can someone help me out, because I have no clue and I cant find anything useful on...
0
1517
by: Jim H | last post by:
I'm trying to use an owner draw ListBox by subscribing to the DrawItem event to draw my custom control as an item in the ListBox. This event is triggered when I drag the scroll button but NOT when...
1
1872
by: jrhoads23 | last post by:
Hello, I subclassed my own ListView which supports column sorting. It automatically draws the up/down sort arrows in the column header. The arrows that are used are drawn by me. I noticed that...
1
1673
by: Gidi | last post by:
Hi, I have DataGrid and i want to use the arrows to navigate up and down between the lines. i also want that each row i'm in, will be marked (as in DataGrid.Select(row_number)). When my form is...
2
10318
by: kalp suth via DotNetMonster.com | last post by:
I want to create arrows using lines on a picture in the picture box. On clicking the button "btnShowAll", the image is loaded and the lines drawn. "RGSShowAll()" calls "DrawObjs()" which does the...
2
2513
by: Notgiven | last post by:
Assuming I find some code that allows you to drag graphics around the page, ideally, I want the relationship between two graphics to be displayed as linked arrows. For example (imagine this in...
9
14663
by: Glenton | last post by:
Hi All I've been knocking my head against this, and wondered if anyone had any insights. I've made a plot with the wonderful matplotlib. I've always found it to work brilliantly, and I've found...
0
7202
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
7084
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
7328
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...
1
6991
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...
0
4672
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...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
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 ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
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...

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.