473,568 Members | 2,882 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 1713
I'm sure you can port this VB ;-)

Dim p As New Pen(Color.Red)
p.StartCap = System.Drawing. Drawing2D.LineC ap.ArrowAnchor
p.EndCap = System.Drawing. Drawing2D.LineC ap.Flat
p.Width = 2
Me.CreateGraphi cs.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****@discuss ions.microsoft. com> wrote in message
news:69******** *************** ***********@mic rosoft.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.LineC ap.ArrowAnchor;
myPen.EndCap = System.Drawing. Drawing2D.LineC ap.Flat;
myPen.Width = 2;
System.Drawing. Graphics formGraphics = this.CreateGrap hics();
formGraphics.Dr awLine(myPen, a, b, c, d);
myPen.Dispose() ;
formGraphics.Di spose();

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

regards

mat
Jul 21 '05 #3
= New Pen ?

"mathon" <ma****@discuss ions.microsoft. com> wrote in message
news:0B******** *************** ***********@mic rosoft.com...
Hello,

I tried it with your code like that:

System.Drawing. Pen myPen = null;
myPen.StartCap = System.Drawing. Drawing2D.LineC ap.ArrowAnchor;
myPen.EndCap = System.Drawing. Drawing2D.LineC ap.Flat;
myPen.Width = 2;
System.Drawing. Graphics formGraphics = this.CreateGrap hics();
formGraphics.Dr awLine(myPen, a, b, c, d);
myPen.Dispose() ;
formGraphics.Di spose();

But I always get a NullReferenceEx ception. 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
1592
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? Thanks, Gerald
1
1562
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...
0
1334
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
7370
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 the internet. Thanks in Advance
0
1520
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 I click the up/down arrows on the scroll bar of the ListBox. How do I handle the user clicking the up/down arrows? Anybody have any ideas? Jim
1
1878
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 Windows XP systems uses different sort arrows than Windows 2000 and earlier systems. (open Windows Explorer and check them out on the two differnt O/S)...
1
1679
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 loaded, my focus is on a textbox i have, and what i want to do is that if i press the arrows keys the focus will be on the dataGrid (on the next...
2
10327
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 actual drawing work. But after displaying all the arrows in a flick, the arrows disappers. I have debugged and came to know that the "Paint" event...
2
2522
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 graphical form): icon1 <----------> icon2 Then the user can drag icon1 around the page and the arrow will still be "connected" to to both. How...
9
14669
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 that even without knowing much about it I can get it to do most of the things I've wanted it to do. Today, I wanted to insert a few arrows onto my...
0
7604
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...
0
7916
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8117
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
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...
0
6275
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...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
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...

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.