c#windows窗体:如何将背景图像大小与窗体大小匹配

c#windows窗体:如何将背景图像大小与窗体大小匹配,c#,winforms,background-image,C#,Winforms,Background Image,我正在尝试将表单大小与表单背景图像大小匹配。守则: var newImage = PB_DEPTH.Image; var newForm = new Form(); newForm.BackgroundImage = newImage; newForm.Width = this.depthFrameDescription.Width; newForm.Height = this.depthFrameDescription.Height; newForm.Show(); 问题是新的形式仍然是图

我正在尝试将表单大小与表单背景图像大小匹配。守则:

var newImage = PB_DEPTH.Image;
var newForm = new Form();

newForm.BackgroundImage = newImage;
newForm.Width = this.depthFrameDescription.Width;
newForm.Height = this.depthFrameDescription.Height;
newForm.Show();
问题是新的形式仍然是图像的一部分。我想这是因为顶部的菜单条包含关闭、最小化、最大化图标

有没有办法获得该条带的大小,而不是应用恒定的偏移值


或者更好的方法是正确调整窗体大小以匹配背景图像尺寸。

尝试将
newForm.ClientSize
设置为背景图像的大小。

窗体的ClientRectangle
是窗体内部的大小。与
Bounds
的区别就是您要寻找的