翻訳を手動で実装するだけで終わりました。コードはそれほど悪くはありませんが、彼らが直接サポートを提供してくれることを望んでいました。このような方法は、さまざまな状況で役立つことがわかりました。
それが彼らが拡張メソッドを追加した理由だと思います:)
擬似コードの場合:
// Recompute the image scaling the zoom mode uses to fit the image on screen
imageScale ::= min(pictureBox.width / image.width, pictureBox.height / image.height)
scaledWidth ::= image.width * imageScale
scaledHeight ::= image.height * imageScale
// Compute the offset of the image to center it in the picture box
imageX ::= (pictureBox.width - scaledWidth) / 2
imageY ::= (pictureBox.height - scaledHeight) / 2
// Test the coordinate in the picture box against the image bounds
if pos.x < imageX or imageX + scaledWidth < pos.x then return null
if pos.y < imageY or imageY + scaledHeight < pos.y then return null
// Compute the normalized (0..1) coordinates in image space
u ::= (pos.x - imageX) / imageScale
v ::= (pos.y - imageY) / imageScale
return (u, v)
画像内のピクセル位置を取得するには、実際の画像のピクセル寸法を掛けるだけですが、正規化された座標を使用すると、ケースバイケースであいまいさを解決するという元のレスポンダーのポイントに対処できます。