.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( 0 0 0 0 );
            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( 183 25 );
            cbtn.Cursor 
=  Cursors.Hand;
            cbtn.Visible 
=   false ;
            cbtn.Click 
+=   new  EventHandler(btn_ClickRightBind);
            
this .flowLayoutPanel1.Controls.Add(cbtn);

 

你可能感兴趣的:(WinForm)