Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Canvas - can a line be one pixel long?

$
0
0

Hi, I'm writing some rendering code and am using Line objects on a Canvas.

The Lines are quite simple:

                Line line = new Line();
                line.Stroke = System.Windows.Media.Brushes.Black;
                line.StrokeThickness = 1;
                line.X1 = ???;
                line.Y1 = ???;
                line.X2 = ???;
                line.Y2 = ???;

Now, if the line length is > 1 the line renders fine. ie, X1 = 10, X2 = 10, Y2 = 20

However, if all coordinates are the same, to X1 = Y1 = X2 = Y2 = 10, no line is rendered.

The behaviour I would *like* is one pixel is drawn.

Is there anyway to force this please?

Thanks,

T


Viewing all articles
Browse latest Browse all 18858

Trending Articles