473,385 Members | 1,732 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,385 software developers and data experts.

Arrows

Hello,

Does anybody know how to draw arrows with C#?

regards

mathon
Jul 21 '05 #1
3 1691
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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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.