winforms - C#: Simple and functional way to zoom picturebox images with scroll bars -
is there simple , functional way zoom image in picturebox including scroll bars?
at moment, use picture box in panel auto scroll activated. zoom, enlarge picturebox , move scroll bars on panel. problem is, behaves strange. example: if zoom in far, margin between upper , left form border , image get's bigger , bigger.
that's zooming method. got here.
private void zoominout(bool zoom) { //zoom ratio images zoomed default int zoomratio = 10; //set zoomed width , height int widthzoom = picturebox_viewer.width * zoomratio / 100; int heightzoom = picturebox_viewer.height * zoomratio / 100; //zoom = true --> zoom in //zoom = false --> zoom out if (!zoom) { widthzoom *= -1; heightzoom *= -1; } //add width , height picture box dimensions picturebox_viewer.width += widthzoom; picturebox_viewer.height += heightzoom; } any appreciated.
thanks in advance.
marco
edit: 2 screenshots of unzoomed , zoomed (16 times) image. pay attention margin between upper border of image , upper border of form.

i think better zoom(rescale) image , not picture box. take @ article - http://www.codeproject.com/articles/21097/picturebox-zoom
and
Comments
Post a Comment