c# - WPF, points are different to RenderTargetBitmap -


my problem int32rect points different ones in canvas. attempted use dpi suggested solution other problems not figure out how use it.

private void bttnexportfb_click(object sender, routedeventargs e)     {         rendertargetbitmap rtb = new rendertargetbitmap((int)maincanvas.actualwidth,         (int)maincanvas.actualheight, 96d, 96d, system.windows.media.pixelformats.default);         rtb.render(maincanvas);          croppedbitmap crop = new croppedbitmap(rtb, new int32rect((int)(173 ), (int)(360), (int)(353 ), (int)(540 )));          bitmapencoder pngencoder = new pngbitmapencoder();         pngencoder.frames.add(bitmapframe.create(crop));          using (var fs = system.io.file.openwrite("logo.bmp"))         {             pngencoder.save(fs);         }      } 

-update- on canvas rectangle created positions of interect32, has different area @ rtb.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -