473,386 Members | 1,842 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,386 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 30620
"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 under? By the way..the part I am talking about is...
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 sometimes highlighted, and you can't always tell where...
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 application of this would be a panel with two buttons...
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. Therefore, I am either over lapping the dotted line, or I...
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 the dotted line between them and the data. I also...
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 (right-justified), with a dotted line between them....
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 there any solution to hide that dotted...
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 a rectangle), when I click on the button...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...

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.