.net winform 从资源文件中引用图片资源

            Button cbtn = new Button();
            cbtn.BackgroundImage = global::MIS.Properties.Resources.button2;    //从资源文件中引用
           
 btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;   

            cbtn.Dock 
= DockStyle.Top;
            cbtn.Text 
= ctext;
            cbtn.Name 
= cname;            
            cbtn.FlatStyle 
= System.Windows.Forms.FlatStyle.Flat;
            cbtn.FlatAppearance.BorderSize 
= 0;
            cbtn.Margin 
= new System.Windows.Forms.Padding(0000);
            cbtn.BackColor 
= System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(233)))), ((int)(((byte)(233)))));
            
//btn.Location = new System.Drawing.Point(0, 0);
            cbtn.Font = new Font(""10);
            cbtn.Size 
= new System.Drawing.Size(18325);
            cbtn.Cursor 
= Cursors.Hand;
            cbtn.Visible 
= false;
            cbtn.Click 
+= new EventHandler(btn_ClickRightBind);
            
this.flowLayoutPanel1.Controls.Add(cbtn);

 

posted @ 2010-07-05 09:31  庚武  Views(1431)  Comments(0Edit  收藏  举报