if (picture != null) { Int32 h = picture.Height; Int32 w = picture.Width; Int32 R = picture.GetPixel(e.X, e.Y).R; Int32 G = picture.GetPixel(e.X, e.Y).G; Int32 B = picture.GetPixel(e.X, e.Y).B; lbPixelValue.Text = "R:"+R+ " G:"+G+ " B:"+B; lbCoordinates.Text = String.Format("X: {0}; Y: {1}", e.X, e.Y);
上記のコードを使用して、ピクチャ ボックス上でマウス オーバーからピクセル値を取得しようとしています。
このコードは正常に実行される場合もありますが、コード エラーが発生する場合もあります。
parameter must to be positive and < height
でのエラー:Int32 R = picture.GetPixel(e.X, e.Y).R;
デバッグしようとしましたが、問題はY > image.height
何が問題なのでY > height
、画像を取得できますか
どうすれば解決できますか?