I Like Pi wrote:
I'm using the default DPI settings. I'm saying that the size of the selection changes when I select "Centimeters" after using "Pixels."
Is this intended?
I figured out what it was. The problem is when you convert from pixels-> cm when the image is set up for inches (DPI),
or when converting from pixels->inches when the image is set up for centimeters (DPCM).
Care to spot the error in the code?

This is a new function in the Document class that was written to handle conversion between measurement types when the basis for measurement could be in another unit system entirely. For example, conversion from X number of pixels to Y number of inches when your basis measurement states there are Z pixels per centimeter. More complex than it sounds and I simply got two little things mixed up in the original implementation.
Fixed for the final release.Code:
public static double ConvertMeasurement(
double sourceLength,
MeasurementUnit sourceUnits,
MeasurementUnit basisDpuUnits,
double basisDpu,
MeasurementUnit resultDpuUnits)
{
// ... (bunch of other code here) ...
// Case 10. Converting from pixels to centimeters, when the basis is in inches.
if (resultDpuUnits == MeasurementUnit.Centimeter && basisDpuUnits == MeasurementUnit.Inch)
{
double dpcm = DotsPerCmToDotsPerInch(basisDpu);
double resultCm = sourceLength / dpcm;
return resultCm;
}
// Case 11. Converting from pixels to inches, when the basis is in centimeters.
if (resultDpuUnits == MeasurementUnit.Inch && basisDpuUnits == MeasurementUnit.Centimeter)
{
double dpi = DotsPerCmToInchPerCm(basisDpu);
double resultIn = sourceLength / dpi;
return resultIn;
}
}
Hint: The "DotsPer...()" calls are backwards / swapped.