Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8650599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:51:48+00:00 2026-06-12T13:51:48+00:00

Following problem. I just tried to draw little things with C#. I would like

  • 0

Following problem. I just tried to draw little things with C#. I would like to do this with a Canvas. But even without Canvas the lines are shown blurry. The simplest thing, which already fails in a simple demo project, is following code:

<UserControl x:Class="Drawing.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <Line Y1="1" Y2="300" StrokeThickness="1" 
              Stroke="Black" Margin="10 0 0 0"/>
    </Grid>
</UserControl>

This line is just shown blurry. I have tried so much, but i can’t figure out how to achieve crisp and one pixel wide lines.

I tried following things:

  • UseLayoutRounding="True"
  • I tried the pixel snapper class – provided here – which doesn’t work for me, either. Here the answer of Xavier Poinas (thread), who has obviously the same problem and also failed with this custom pixel snapper: “The coordinates I seem to understand that this class works by snapping the bounds of an item to round pixels, but the coordinates I use are already integers, and in the case of a path, snapping the bounds might not mean that the contents fall on round pixels either.”)

It would be good, if a solution was found, that allows me to snap lines, which are hold by a Canvas.

The reason for this is: for technical reasons we needed a borderless OOB application, which implements a custom border (resizing) and also a custom application bar, which contains the minimize, maximize and close items. I just tried draw these icons by hand, via lines etc.:

BarIcons

Is there maybe an easier way? I just don’t want to use image resources. Thanks!

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:51:49+00:00Added an answer on June 12, 2026 at 1:51 pm

    The coordinates are points between pixels.

    The blurry line you’re seeing is a result of the render engine trying to spread the drawing equally between both pixels that a 1px line would cover with this being the case.

    This allows an engine to work from 0,0 to maxX,maxY and still use partial pixel rendering.

    add 0.5 to your coords and it will appear sharp as a tack.

    Or translate to 0.5,0.5

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd just like someone to verify whether the following problem is NP-complete or if
I am just starting working with jquery and have encountered the following problem <div
I am just starting out with JNI and I have a following problem. I
I experience the following problem while using legacy VC6. I just cann't switch to
I am running xcode 4.3.2 and just started having the following problem. All projects
The problem is purely academic, so the following is just an example; if I
I have just tried the following in Python 2.6: >>> foo = (set(),) >>>
I've tried for a few hours to get a solution for the following problem.
I've just started using Fluent NHibernate and have run into the following problem trying
I have the following problem: I created the servlet which should draw a dynamic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.