473,289 Members | 1,917 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,289 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 30600
"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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.