繁体   English   中英

C#中的图片框和调整图像提取大小

[英]Picturebox in c# and resize image extraction

我现在在图片框中启用了调整大小模式(拉伸),当我提取图像时,它不会提取与图片框相同大小的图像,而是采用原始图片大小......任何提取拉伸图像的方法。 我更关心宽度和高度。

详细信息 Winform c# Visual Studio 2013

你可以试试这个:

        Bitmap result = new Bitmap(picturebox.width, pixturebox.height);
        using (Graphics g = Graphics.FromImage(result))
            g.DrawImage(original_image, 0, 0, picturebox.width, 
                        pixturebox.height);

您实际上创建了一个具有 PictureBox 当前宽度和高度的新位图。 然后,您可以保存图像:

    result.Save(filename);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM