TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
William Thompson
1.6k
155
298.9k
How do you draw a line on a canvas in WPF that is 1 pixel thick?
May 20 2010 9:50 PM
How do you draw a line on a canvas in WPF that is 1 pixel thick?
This is the method I am using for drawing a line on a canvas in WPF that uses the line class set to 1 pixel thick but it actually draws a line that is two pixels thick:
[code]
Line myLine = new Line();
myLine.Stroke = System.Windows.Media.Brushes.Black;
myLine.X1 = 100;
myLine.X2 = 140;
myLine.Y1 = 200;
myLine.Y2 = 200;
myLine.StrokeThickness = 1;
graphSurface.Children.Add(myLine);
[/code]
Microsoft might have decided to set a standard for line thickness and the minimum is 2 pixels thick when you set the strockThickness to 1, but when you already have rectangles drawn in XAML and even error fonts using WingDings, it is an obvious miss-match. How do you draw a line that is truly 1 pixel thick?
Reply
Answers (
0
)
SEND AND RECEIVE SMS FROM PC TO MOBILE IN .NET WINDOWS APPLICATION
How do you send a refresh message to a WPF grid or canvas?