C# 窗体更换背景图片

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;

namespace 常用
{
    public class 常用
    {
        public static void 更换背景图片(T ff, Image 背景图片, int 层次) where T : System.Windows.Forms.Control
        {
            ff.BackgroundImage = 背景图片;
            if (层次-- > 0)
            {
                for (int i = 0; i < ff.Controls.Count; i++)
                {
                    更新背景图片(ff.Controls[i], 背景图片, 层次);
                }
            }
        }
    }
}
 

你可能感兴趣的:(c#,image,system,class)