好的,我有一个带有图像的图片框,其 sizeMode 设置为:StretchImage,
现在,我想获取我单击的像素。(位图。GetPixel(x,y))。
但是当图像从正常尺寸拉伸时,我得到原始像素。就像在拉伸之前存在的像素一样(如果这有意义?)
我的代码:
Private void pictureBox1_MouseUp(object sender, MouseEventArgs e) {
Bitmap img = (Bitmap)pictureBox1.Image;
var color = img.GetPixel(e.X, e.Y)
}
Run Code Online (Sandbox Code Playgroud)
提前致谢