472,331 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Drawing a dotted line

I tried searching the newsgroups to see how do you draw a dotted line but I
was unable to find an answer, drawing a straight line is very easy but not a
dotted one.

So the question is, how do I draw a dotted line?

Thank you.
Nov 15 '05 #1
6 30442
"Rene" <no****@nospam.nospam> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I tried searching the newsgroups to see how do you draw a dotted line but I was unable to find an answer, drawing a straight line is very easy but not a dotted one.

So the question is, how do I draw a dotted line?


The way this tends to work in page description languages is the most obvious
trickery - draw a bunch of small short lines in a row.

R.
Nov 15 '05 #2
You can select a line style for a pen that includes standard dot, dot-dash
and so-on or create a custom line style. Lines drawn by pens may also have
end-caps shaped like arrows, diamonds or dots.

Look at System.Drawing.Pen and the DashStyle property which contains a
DashStyle enumeration value.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Rene" <no****@nospam.nospam> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I tried searching the newsgroups to see how do you draw a dotted line but I was unable to find an answer, drawing a straight line is very easy but not a dotted one.

So the question is, how do I draw a dotted line?

Thank you.

Nov 15 '05 #3
Not bad, if fact not bad at all... but now I need to scale the line so that
the space between the different patterns is bigger, for example I am
currently using the dash-dot style but the dash and dot are so close
together that in a high resolution screen you can barely tell the line is
not a solid line! Is there a way to scale the line spaces or am I going to
have to create a custom style??

Thank you.

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:O%******************@TK2MSFTNGP11.phx.gbl...
You can select a line style for a pen that includes standard dot, dot-dash
and so-on or create a custom line style. Lines drawn by pens may also have
end-caps shaped like arrows, diamonds or dots.

Look at System.Drawing.Pen and the DashStyle property which contains a
DashStyle enumeration value.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Rene" <no****@nospam.nospam> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I tried searching the newsgroups to see how do you draw a dotted line
but I
was unable to find an answer, drawing a straight line is very easy but
not a
dotted one.

So the question is, how do I draw a dotted line?

Thank you.


Nov 15 '05 #4

Hi Rene,

I think you should do some custom drawing.
For example, you can take Richard's suggestion, do some trickery, draw a
bunch of small short lines combine with some dot.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #5
Custom line styles are easy to create and much simpler that trying to
hand-draw a bunch of individual dots and dashes...

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Rene" <no****@nospam.nospam> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
Not bad, if fact not bad at all... but now I need to scale the line so that the space between the different patterns is bigger, for example I am
currently using the dash-dot style but the dash and dot are so close
together that in a high resolution screen you can barely tell the line is
not a solid line! Is there a way to scale the line spaces or am I going to
have to create a custom style??

Thank you.

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:O%******************@TK2MSFTNGP11.phx.gbl...
You can select a line style for a pen that includes standard dot, dot-dash and so-on or create a custom line style. Lines drawn by pens may also have end-caps shaped like arrows, diamonds or dots.

Look at System.Drawing.Pen and the DashStyle property which contains a
DashStyle enumeration value.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Rene" <no****@nospam.nospam> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I tried searching the newsgroups to see how do you draw a dotted line

but
I
was unable to find an answer, drawing a straight line is very easy but

not
a
dotted one.

So the question is, how do I draw a dotted line?

Thank you.



Nov 15 '05 #6
For example...

Pen dp=new Pen(Brushes.Black,1);

dp.DashPattern=new float[]{10f,3f,3f,3f};

e.Graphics.DrawLine(dp,0,0,100,100);
--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Rene" <no****@nospam.nospam> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
Not bad, if fact not bad at all... but now I need to scale the line so that the space between the different patterns is bigger, for example I am
currently using the dash-dot style but the dash and dot are so close
together that in a high resolution screen you can barely tell the line is
not a solid line! Is there a way to scale the line spaces or am I going to
have to create a custom style??

Thank you.

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:O%******************@TK2MSFTNGP11.phx.gbl...
You can select a line style for a pen that includes standard dot, dot-dash and so-on or create a custom line style. Lines drawn by pens may also have end-caps shaped like arrows, diamonds or dots.

Look at System.Drawing.Pen and the DashStyle property which contains a
DashStyle enumeration value.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Rene" <no****@nospam.nospam> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I tried searching the newsgroups to see how do you draw a dotted line

but
I
was unable to find an answer, drawing a straight line is very easy but

not
a
dotted one.

So the question is, how do I draw a dotted line?

Thank you.



Nov 15 '05 #7

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

Similar topics

3
by: news-server | last post by:
Hi, I was wanting to get a dotted line..Such as they have on http://www.e-cbd.com/ What part of the CSS in dreamweaver is this going to be...
4
by: melanieab | last post by:
Hi, I'm trying to find the command(s) that will force buttons to be highlighted any time they're in focus. At the moment, buttons are only...
1
by: Carl Gilbert | last post by:
Hi I am looking to draw a dotted line between two controls at design time and render this at run time in a similar fashion. The most basic...
1
by: troy_s11 | last post by:
I am trying to add a dotted line after a text box. The trouble I am having is the data that is in the text box is all different lengths....
2
by: Daniel.Peaper | last post by:
Hi folks, I'm trying to write a simple SELECT statement that will execute in query analyser but will just have the data with no column names, or...
3
by: saathujaya | last post by:
Hi, I want to draw a dotted line.So how to colour the pixel with distance?(like ..... )
2
by: Brian Kendig | last post by:
I'm trying to make a web page with a restaurant menu on it. Each line on the menu is the name of a dish (left-justified) and that dish's price...
6
by: pravinnweb | last post by:
hi i am new to javascript i hav some problem with button in page that is when i set the focus to button the dotted line appear around the button is...
2
by: FredZimmerman | last post by:
When I have my black backround for Body and my button is a round .GIF image (actually image has round green button on black backround, whole thing...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.