I want an image to crop so that it will fill completely inside a rectangle when stretched.
For example, in Windows 7 & when you set wallpaper position to "Fill" then it does same thing.

I'm trying to add this feature in BackgroundImageLayout of a form or in SizeMode of a picturebox.
So, if I just find the centered crop position and crop the image with correct aspect ratio, then the form/picturebox will show that image correctly if viewing in "stretched" mode.

The solution seems to be easy, but unfortunately I couldn't think of any formula that will give me correct crop position of original image.

Any idea ?