I have a peculiar problem,
I have a tabpage with a label control on it. When i set a background
image to the tabpage and drag the label around it has paint issues in
that it is slow, granted the image i am using is 5mb!!! HOWEVER...
I have inherited the tabpage created an Image reference in it, and
overrriden the onPaint method to draw the image
now if i press a button that sets the background image of the control
and drag it works really slow, however if i then set the backimage to
null and set my own image reference IT works FINE!!! No issues even a
5MB image. If i just set my own internal image first it isnt smooth
however setting it after the backimage ON/OFF does cause it to work.
However i cant set and unset the background image in code as that
does not make it work properly it has to happen in that order and via
a button etc. Could it be something todo with focus????
Could someone explain to me why this is happening? As i am unable to
understand what is happening, and a solution to my problem?
Thanks!!!!!!!!
Below is the code to my tabpage
public class TabWork : TabPage
{
public Image imagex;
public TabWork()
{
}
protected override void OnPaint(PaintEventArgs e)
{
if(imagex!=null)
{
e.Graphics.DrawImageUnscaled(imagex, 0, 0, imagex.Width,
imagex.Height);
} base.OnPaint (e);
}
protected override void OnPaintBackground(PaintEventArgs pevent)
{
base.OnPaintBackground (pevent);
}
}