停靠背景图片c#

时间:2018-06-01 08:00:49

标签: c# winforms

我希望将背景图片停靠在表单的底部。目前我有一个背景图像位于表单的中心,并希望更改为图像在底部的位置。 我试过对接但不幸失败了。

提前致谢。

    this.BackgroundImageLayout = ImageLayout.Zoom;
    this.BackgroundImage = Image.FromFile(@"C:\Users\Desktop\Shooter\Shooter\AppleShooter\Resources\Finalbackground1.png");

1 个答案:

答案 0 :(得分:1)

您可以设置panel并将其停靠在底部,然后将主picturebox停靠在中心。在底部的面板中添加另一个picturebox,然后将其停靠到中心,并添加背景图像。你的表格看起来像这样:

enter image description here

将所选背景图像加载到资源中后,将其添加到picturebox。在picturebox设置中,请确保在最大化表单时将backgroundImageLayout设置为stretch,后台将展开。