c# - How to resize a picturebox in the user control when a button is clicked in the form? -


so new c#, , user controls making mess in head.

currently working on create user control, should act progress bar, thought can try , use panel , put picture box in it, showing progress, , in form have 2 buttons stating next , back. progress bar used in wizards detecting steps. consider have 15 steps , when press next button picture box should expand ratio of (width_of_the_panel/15(no of steps)). confused can write resize_method. if mention in usercontrol how can access form?

private void image_size() {     if (picturebox1.image.width < picturebox1.width && picturebox1.image.height < picturebox1.height)     {         picturebox1.sizemode = pictureboxsizemode.normal;     }     else     {         picturebox1.sizemode = pictureboxsizemode.zoom;     }     int wid = panel1.width / val;     image img = new bitmap(panel1.width, panel1.height);     graphics gr = graphics.fromimage(img);     gr.smoothingmode = smoothingmode.highquality;     gr.interpolationmode = interpolationmode.highqualitybicubic;     gr.pixeloffsetmode = pixeloffsetmode.highquality;     gr.drawimage(img, 0, 0, wid, panel1.height); } 

you can use regular progress bar, 1 provided .net. use progressbar.maximum , progressbar.step properties, suit wizard style. if need customization, can inherit progressbar, or create composite usercontrol progressbar on it. there no need reinvent wheel , create own progressbar scratch.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -