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

  • Home
  • SEARCH
  • 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 8796051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:31:58+00:00 2026-06-13T23:31:58+00:00

I’m puzzled. I have created a PNG image that to be a divider in

  • 0

I’m puzzled.

I have created a PNG image that to be a divider in my application display and the image is 3 pixels high like this:

enter image description here

However when I display it on my C# WPF window and run it, the divider is shown to be about 4 pixels instead, with the colours being off.

Code:

<StackPanel Height="3">
    <StackPanel.Background>
        <ImageBrush ImageSource="Assets/divider.png" Stretch="None"
            AlignmentX="Left" AlignmentY="Top" Viewport="0,0,20,3" 
            ViewportUnits="Absolute" TileMode="FlipX" />
    </StackPanel.Background>
</StackPanel>

Output and Zoom:

enter image description here

What I’ve thought would be that the image is “stretched” (despite Stretch="None") or there is some mechanism to optimize the image, so I did away with the image and wrote it with 3 rectangles with the same color and 1 pixel height each like this:

<StackPanel Height="3" Orientation="Vertical">
    <Rectangle Fill="#484848" Height="1" />
    <Rectangle Fill="#222" Height="1" />
    <Rectangle Fill="#484848" Height="1" />
</StackPanel>

However the results were similar: 4 pixels and colours run off (not exact colours as specified):

enter image description here

Other than pixels being off, the colours are off too. My colours are supposed to be #484848, #222222, #484848. When displayed on the WPF window, the shades goes off a little (too many shades of grey!)

I need the separator to fill the window with too as the window gets resized. I’m a perfectionist and I want that 3 pixel height separator to be pixel perfect. Any solution to solve that problem?

  • 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-13T23:32:00+00:00Added an answer on June 13, 2026 at 11:32 pm

    With thanks to @Brian and @Sisyphe, I am able to display the lines properly. However this is still a solution done through Rectangle displays and I reckon there’s a better solution.

    Here’s my current solution:

    <StackPanel HorizontalAlignment="Stretch" Height="3">
        <Rectangle Fill="#484848" Height="1" RenderOptions.EdgeMode="Aliased" />
        <Rectangle Fill="#222222" Height="1" RenderOptions.EdgeMode="Aliased" />
        <Rectangle Fill="#484848" Height="1" RenderOptions.EdgeMode="Aliased" />
    </StackPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

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.