Try adding this:
myLine.SnapsToDevicePixels = true;
That will stop WPF from rendering "half pixels" to antialias your line.
Matt Hamilton
2010-05-21 01:25:11
Try adding this:
myLine.SnapsToDevicePixels = true;
That will stop WPF from rendering "half pixels" to antialias your line.
Two things:
myLine.SnapsToDevicePixels = true;
myLine.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
Apart from what has been suggested, it might also be possible that your screen resolution is more than 96 DPI. Whatever measurements you are giving to WPF, by default WPF will always assume that 96 pixels corresponds to 1 inch.
The result is, on a screen of say 192 DPI (96 * 2), drawing a line of thickness 1 will draw a line with thickness of 2 pixels.
If this is the case, you will have to explicitly specify the units.