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 757905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:25:02+00:00 2026-05-14T15:25:02+00:00

Here is a code. var image = new BitmapImage(new Uri(@pack://application:,,,/Images/background.png, UriKind.RelativeOrAbsolute)); var backgroundBrush =

  • 0

Here is a code.

var image = new BitmapImage(new Uri(@"pack://application:,,,/Images/background.png",
          UriKind.RelativeOrAbsolute));

   var backgroundBrush = new ImageBrush()
   {
    ImageSource = image,
    Viewport = new Rect(0, 0, image.PixelWidth / ActualWidth,
          image.PixelHeight / ActualHeight),
    TileMode = TileMode.Tile,
    Stretch  = Stretch.None,
   };

   // Set it for the main window.
   Background = backgroundBrush;

It works just fine on my PC with XPSP3 and .Net 4.0. But when I run the same sample on Eee PC T91MT with Windows 7 Home Premium it fails. No exceptions, but nothing is drawn (solid color brushes ARE drawn if used instead, though). I thought it could be the result of limited resources, but on Viliv S5, that has about the same specs it works fine too.

Any ideas?

Thanks!


UPDATE

The root of the problem is Viewport’s rect. Since the bitmap has twice window’s size by X, the rect is (0, 0, 2, 1). So, on power computer with XPSP3, the left half of the image is drawn. But on Eee PC it causes a problem with visualization.

  • 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-05-14T15:25:02+00:00Added an answer on May 14, 2026 at 3:25 pm

    The answer is just normalizing Viewport rectangle. E.g. instead of (0,0,2,1) I had to set it as (0,0,1,0.5).

    I’m not sure, but it looks like WPF just transmit rect values (after some transformation) into a D3D driver, which is (or is not) able to handle it the right way. So, non-normalized rect Viewport works on GeForce-based machine but does not on Eee PC with it’s integrated video’s driver.

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

Sidebar

Related Questions

I have an image in my code, as defined here var imageObj = new
Here is my code: function testimage() { var image; image = new Image(); with
I check like this: enter code here var point = new g.LatLng(parseFloat(lat),parseFloat(lng)); var bounds
I'm using code similar to below: var image = new Image(); image.src = http://youtube.com/favicon.ico;
Here is my code: var menu = new Menu (); menu.x = 0; menu.y
I am trying to make a POST request. Here my code: var myModel =
Here is my code - var obj = $('[id$=ddlInsert4]') obj.disable = true; obj is
Here is my code: var finiGames = myRepos.Games .Where(x => x.StatusGameId == (int)StatusGameEnum.Finish &&
Here is my code: var items = tableInDatabase.All(WHERE [Order] > + order); foreach (var
Here is my code: var showNo = 1; window.setInterval(function() { console.log(showNo); if(showNo === 1)

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.