WPF Background setting failed -


here 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 main window.    background = backgroundbrush; 

it works fine on pc xpsp3 , .net 4.0. when run same sample on eee pc t91mt windows 7 home premium fails. no exceptions, nothing drawn (solid color brushes drawn if used instead, though). thought result of limited resources, on viliv s5, has same specs works fine too.

any ideas?

thanks!


update

the root of problem viewport's rect. since bitmap has twice window's size x, rect (0, 0, 2, 1). so, on power computer xpsp3, left half of image drawn. on eee pc causes problem visualization.

the answer normalizing viewport rectangle. e.g. instead of (0,0,2,1) had set (0,0,1,0.5).

i'm not sure, looks wpf transmit rect values (after transformation) d3d driver, (or not) able handle right way. so, non-normalized rect viewport works on geforce-based machine not on eee pc it's integrated video's driver.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -