Hi Sharon,
Welcome to MSDN Newsgroup!
I don't make sure how you use a class bitmap member in code. However, if we
use it as follows, it could work well. You could refer to the following
code and if I misunderstood you, please feel free to let me know. Thanks!
namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private Bitmap m_bmp;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
panel1.BackgroundImage = m_bmp;
}
#region Windows
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(56, 56);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(128, 96);
this.panel1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
//
// Bitmap
//
this.m_bmp = new Bitmap("c:\\temp\\1.bmp");
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
If there is any question, please feel free to join the community and we are
here to support you at your convenience. Thanks again and have a nice day.
Best Regards,
Terry Fei[MSFT]
Microsoft Community Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)