While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?
Styling with Markdown is supported
21 February 2015 Reply
I want to thank you for this control too!
I find it very usefull!
You save me a lot of work in my program! :)
One question do, is it possible to change the zoom to float, or why did you use int?
(On my image viewer program the zoom is not perfectly fit to the window)
Thanks a lot again!
Thanks for the comment, glad you enjoy the control!
The Zoom property is an int because I thought it was easier. A zoom level of 100% is 100. 500% is 500. 50% is 50. Easier than 1, 5 or 0.5 I would have thought! (And I didn't really think users would want to specify 50.75%). Behind the scenes it is converted into a double and that is the value used for all calculations.
Assuming you are embedding the source directly in your project, you could just change the Zoom property to be a float directly and then adjust the calculation in ZoomFactor to do something other than Zoom / 100. Or, if you are using the NuGet package or don't wish to modify the original source you could add a new float based zoom property and then override both Zoom and ZoomFactor to use your new property and everything else should just work.
Zoom / 100
However, I don't really recall having an issue where the int based system didn't work - if you have an example, can you either sent it via email, or post it on our forums for further investigation?
Thank you for your quick answer!
I write a kind of image viewer program with some extra functions. Something like (the great :) ) irfanview, but much smaller project.
Basically I have pictures -e.g.: from a digital camera, or from my phone, around 8-12 megapixel-, and I want to display them, make sure it's fit to the desktop. So if it's bigger, then I need to use the zoomtofit function. If I have 2448x3264 pixel image, and my monitor is 1920x1080 (include window frame, menu, toolbar, status-bar), I end up with 28,49% of zoom.
If the zoom is 28, then I have 3-4 millimeter "frame" around my image. I like to have without it . :)
I already solved the problem, based on your guidance. I really thank you for that! :)
However I had to make a little bit more modification to accomplish that (technically I had to replace almost all int to float), so it would be hard to post in the forum.
Also I changed selection to mouse right click, because I use left to drag image (or the selected area if any).
Also the zoom with mouse wheel to z+mouse wheel, because I navigate with the mouse, loop in the folder to load images.
If you like to have the imageBox (+imageBoxEx) project with my modifications (based on Cyotek.Windows.Forms.ImageBox +.Demo, +.Design), or pictures over the problem, I more than happy to send you.
Thank you again,