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
Post a Comment