image - WPF ZoomControl and Adorners -
this first post on stack overflow, hope right. using zoomcontrol wpf extensions display image pan , zoom support:
<dockpanel grid.row="1" x:name="canvas"> <controls:zoomcontrol x:name="zoomcontrol"> <canvas x:name="canvas"> <image x:name="imagecontrol" stretch="none" /> </canvas> </controls:zoomcontrol> </dockpanel>
when user selects image bowse dialog, load image so:
bmp = new bitmapimage(new uri(filename)); this.imagecontroul.source = bmp;
i added rectangles\adorners specific locations (pixel coordinates) on image user loaded based on image processing.
var r = new rectangle(); r.strokethickness = 5; r.stroke = brushes.black; r.fill = brushes.transparent; r.width = width; r.height = height; canvas.setleft(r, y); canvas.settop(r, x); canvas.children.add(r);
however, rectangles not placed in expected locations? wrong scale , location.
thanks,
john
i expect problem canvas expanding fill space rather being locked rectangle. have tool snoop , see bounding boxes of 2 are.
you might able fix horizontal , vercticalalignment on canvas, set them other stretch.
if doesn't work restructure this
<zoombox> <grid> <image/> <canvas/> </grid> </zoombox>
so image , canvas grouped parent grid being transformed.
Comments
Post a Comment