程序运行时,图片框大小会扩大

时间:2013-05-08 06:55:24

标签: c# webcam qr-code picturebox

我目前正在学习基于网络摄像头的qr代码解码器我已经从https://zxingnet.svn.codeplex.com/svn/trunk/Clients/AForgeDemo/做了一个例子。我已经设法让它工作,但我有一个困扰我的问题。它与我的GUI中的图片框有关。

enter image description here

上面的图像是在按下开始/继续按钮之前。后面的图像如下

enter image description here

图片框属性中是否有任何设置可能会阻止图片框扩展,或者我是否需要输入源代码。如果有人能突出我需要做些什么来阻止图片框的消费,那将是很棒的。谢谢

3 个答案:

答案 0 :(得分:0)

单击开始按钮

,请尝试此代码
private void Button1_Click(System.Object sender, System.EventArgs e)
{
// Set the SizeMode property to the StretchImage value.  This 
// will enlarge the image as needed to fit into 
// the PictureBox.
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
}

希望它会帮助你

答案 1 :(得分:0)

似乎你必须将PictureBox.SizeMode设置为除了AutoSize以外的其他内容。

答案 2 :(得分:0)

将图片框的MaximumSize属性设置为您想要的大小。您也可以设置MinimumSize