日期:2014-05-17  浏览次数:20797 次

动态加载的picturebox,为什么改变不了背景,请高手指点,谢谢!
直接上代码了
 public partial class TestForm : Form
    {
        public TestForm()
        {
            InitializeComponent();
            LoadTheTopMenu();
        }
        #region 
        private void LoadTheTopMenu()
        {
            int w = 0;   //增加宽度

            int wl = 0;
            //int hl = 0;

            int i = 1;
            for (; i < 3; )
            {
                PictureBox pic_xt_01 = new PictureBox();
                pic_xt_01.Location = new System.Drawing.Point(36 + w, 20);
                pic_xt_01.Name = "pic_xt_0" + i;
                pic_xt_01.Size = new System.Drawing.Size(78, 72);
                pic_xt_01.TabIndex = 2;
                pic_xt_01.TabStop = false;
                pic_xt_01.Image = Properties.Resources.topMenu_01;
                pic_xt_01.Cursor = System.Windows.Forms.Cursors.Hand;
                pic_xt_01.MouseEnter += pic_xt_01_MouseEnter;
                pic_xt_01.MouseLeave += pic_xt_01_MouseLeave;
                pic_xt_01.Click += new EventHandler(pic_xt_01_Click);
                Label lab_xt_01 = new Label();
                lab_xt_01.AutoSize = true;
                lab_xt_01.BackColor = System.Drawing.Color.Transparent;
                lab_xt_01.Location = new System.Drawing.Point(62 + wl, 75);
                lab_xt_01.Name = "la