You must be more precise in your questions !
Again, what application are you refering to ?
Do you already have some code ?
General answer:
If you define the width or height of the crop rectangle anywhere in your program limit their values, max or min.