c# 设置MdiClient窗体的背景图片

在窗体的InitializeComponent();方法后面添加下面的代码。

MdiClient MC = new MdiClient();
MC.Name = "MdiClientForm";
MC.Dock = DockStyle.Fill;
MC.BackgroundImageLayout = ImageLayout.Stretch;这句其实不会起作用的,写在这里只是说明一下。
MC.BackgroundImage= global::DispenserAutomatic.Properties.Resources.bg;

要想使用BackgroundImageLayout属性,只要设置主窗体的BackgroundImageLayout属性就会起作用了。

猜你喜欢

转载自www.cnblogs.com/derekhan/p/10415641.html