I am writing a Windows Forms application graphing routine using VS.NET 2003,
Visual C# and .NET Framework 1.1.

The Graphics.DrawLine(Pen,int,int,int,int) method seems to work okay unless
the desired line being drawn is only one pixel long (horizontally). I have
not found a way to get a horizontal line of only one pixel to be drawn. I
either get no line or a two pixel line.

Example method calls:

Graphics.DrawLine( Pen, 20, 50, 21, 50 ); // Results in two pixel long line.
Graphics.DrawLine( Pen, 20, 50, 20, 50 ); // Results in no pixels being
drawn.

So how do I get a one pixel long line?

Thanks,
Dave

Re: How to draw a 1 pixel long line using Graphics.DrawLine? by Herfried

Herfried
Wed Dec 07 17:30:51 CST 2005

"Dave Leach" <babel@newsgroup.nospam> schrieb:
>I am writing a Windows Forms application graphing routine using VS.NET
>2003,
> Visual C# and .NET Framework 1.1.
>
> The Graphics.DrawLine(Pen,int,int,int,int) method seems to work okay
> unless
> the desired line being drawn is only one pixel long (horizontally). I
> have
> not found a way to get a horizontal line of only one pixel to be drawn. I
> either get no line or a two pixel line.

<URL:http://www.bobpowell.net/single_pixel_lines.htm>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Re: How to draw a 1 pixel long line using Graphics.DrawLine? by babel

babel
Thu Dec 08 11:58:03 CST 2005

The link provided in the reply below deals with line width. I am asking how
to make a line 1 pixel in LENGTH. We are already able to draw lines that are
one pixel wide.

So again, the issue is how to draw a line that is one pixel in length?

Dave

"Herfried K. Wagner [MVP]" wrote:

> "Dave Leach" <babel@newsgroup.nospam> schrieb:
> >I am writing a Windows Forms application graphing routine using VS.NET
> >2003,
> > Visual C# and .NET Framework 1.1.
> >
> > The Graphics.DrawLine(Pen,int,int,int,int) method seems to work okay
> > unless
> > the desired line being drawn is only one pixel long (horizontally). I
> > have
> > not found a way to get a horizontal line of only one pixel to be drawn. I
> > either get no line or a two pixel line.
>
> <URL:http://www.bobpowell.net/single_pixel_lines.htm>
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
>
>

Re: How to draw a 1 pixel long line using Graphics.DrawLine? by Herfried

Herfried
Thu Dec 08 12:14:18 CST 2005

"Dave Leach" <babel@newsgroup.nospam> schrieb:
> The link provided in the reply below deals with line width. I am asking
> how
> to make a line 1 pixel in LENGTH. We are already able to draw lines that
> are
> one pixel wide.
>
> So again, the issue is how to draw a line that is one pixel in length?

See:

<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/9492fe4a2b69530a>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Re: How to draw a 1 pixel long line using Graphics.DrawLine? by babel

babel
Fri Dec 09 10:46:03 CST 2005

If this is how a 1 pixel "line" is drawn does no one else think that the
Graphics.DrawLine method is defective? Shouldn't the method support drawing
lines from 1 to N pixels in length?

Dave

"Herfried K. Wagner [MVP]" wrote:

> "Dave Leach" <babel@newsgroup.nospam> schrieb:
> > The link provided in the reply below deals with line width. I am asking
> > how
> > to make a line 1 pixel in LENGTH. We are already able to draw lines that
> > are
> > one pixel wide.
> >
> > So again, the issue is how to draw a line that is one pixel in length?
>
> See:
>
> <URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/9492fe4a2b69530a>
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
>
>

Re: How to draw a 1 pixel long line using Graphics.DrawLine? by Herfried

Herfried
Fri Dec 09 10:53:21 CST 2005

"Dave Leach" <babel@newsgroup.nospam> schrieb:
> If this is how a 1 pixel "line" is drawn does no one else think that the
> Graphics.DrawLine method is defective? Shouldn't the method support
> drawing
> lines from 1 to N pixels in length?

'DrawLine' doesn't draw n pixels, it draws n units.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>