G
Guest
I’m using a Panel control in my form to display a background image.
So in the Form OnPaint() I wrote:
myPanel.BackgroundImage = m_bmp;
While the m_bmp is the Form Bitmap member.
The problem is that the image is not shown on the screen.
But if change the code in the OnPaint() to:
Bitmap bmp = new Bitmap(m_bmp, m_bmp.Width, m_bmp.Height);
myPanel.BackgroundImage = bmp;
It works fine.
After doing some more testing, I found that if the image that I’m attaching
to the myPanel.BackgroundImage is a class member of the Form ïƒ It does not
work.
But if the attached image is a local image of the OnPaint() ïƒ It works OK.
Can anybody tell me why it happens and how to make it work with a bitmap
member?
So in the Form OnPaint() I wrote:
myPanel.BackgroundImage = m_bmp;
While the m_bmp is the Form Bitmap member.
The problem is that the image is not shown on the screen.
But if change the code in the OnPaint() to:
Bitmap bmp = new Bitmap(m_bmp, m_bmp.Width, m_bmp.Height);
myPanel.BackgroundImage = bmp;
It works fine.
After doing some more testing, I found that if the image that I’m attaching
to the myPanel.BackgroundImage is a class member of the Form ïƒ It does not
work.
But if the attached image is a local image of the OnPaint() ïƒ It works OK.
Can anybody tell me why it happens and how to make it work with a bitmap
member?