图片框之间的差距 [英] Gap between picture boxes

查看:71
本文介绍了图片框之间的差距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个C#应用程序,允许用户为他想要的任何图片选择框架。

I'm trying to create a C# application which allows the user to choose frames for any picture he wants.

我的想法是我有一张20厘米的照片例如,一块木制框架,代码会在中心图片周围放置这件作品的副本。为了创建框架的每一面,我使用了flowLayoutpanel,并在其中放置了包含
帧图像的图片框。要将图片框放在彼此旁边,并创建一个单件的幻觉,所有图片框的边距都设置为0.但是它们之间总是存在很小的差距。

The idea is that i have a picture of a 20cm piece of wooden frame for example, and the code would place a copy of this piece all around the center picture. To create each side of the frame I used a flowLayoutpanel and I placed pictureboxes containing the frame image inside it. To place the pictureboxes right next to each other, and create the illusion that it is one single piece, all pictureboxes have their margin set to 0. However there's always a very small gap between them.

任何人都可以帮我弄清楚如何摆脱这个差距吗?

Can anyone help me to figure out how I can get rid of this gap?

 我已经尝试了所有可能的方法来创建框架,无论是将框架图片放在图片框中边框样式设置为无,或在面板中,或使用DrawImage绘制它。我尝试自己设置每个图片框的位置,或者将图片框中的
放在flowlayoutpanel中,以便它们并排并排,并且填充和边距始终设置为0,所有方法都会产生相同的结果。    

 I have tried all possible methods to create the frame, whether placing the frame picture in a picture box with border style set to none, or in a panel, or drawing it using DrawImage. I tried setting the location of each picture box myself or placing the pictureboxes inside a flowlayoutpanel for them to be aligned and side by side, with padding and margins always set to 0, all methods yield to the same result.    

以下是我尝试过的方法之一:

Here is one of the methods i tried:

for(int i = 0; i< 5; i ++)

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP;小组p =新小组();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; p.Size = horztopframe.Size;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; p.Margin = new Padding(0);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; p.BackgroundImage = horztopframe;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; flowLayoutPanel1.Controls.Add(p);

  &NBSP; &NBSP; &NBSP; &NBSP;  }



$

for (int i = 0; i < 5; i++)
            {
                Panel p = new Panel();
                p.Size = horztopframe.Size;
                p.Margin = new Padding(0);
                p.BackgroundImage = horztopframe;
                flowLayoutPanel1.Controls.Add(p);
           }


推荐答案

它可以是FLowLayoutPanel而不是PictureBox的错误。确保FlowLayoutPanel的
Padding 属性设置为零。
It could be the fault of the FLowLayoutPanel instead of the PictureBox. Make sure that the Padding property of the FlowLayoutPanel is set to zero.


这篇关于图片框之间的差距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆