Hi,
I'm writing an app that will show a scrolling transparent graph and I'm
ancountering some problems, explained in the following code:
(a VS project explaining the problem(s) can be downloaded at
http://www.icat.be/problems.zip )
The code is executed on a timer.tick event:
// Draw Using Double Buffering, this works perfectly if the monitor
// is set to 16-bit Color mode, if it is set to 32-bit color mode
// the background of the graph will be blue, I know this is a known bug
// bug ID KB820640, will Microsoft resolve this ????
BackgroundBmp.M akeTransparent( Color.Red);
this.OffScreenB mp = new Bitmap(Backgrou ndBmp);
this.OffScreenD C = Graphics.FromIm age(this.OffScr eenBmp);
Graphics ClientDC = this.CreateGrap hics();
BackGroundBrush = new SolidBrush(Colo r.Blue); //Blue is the tranparencykey
of the form
this.OffScreenD C.FillRectangle (BackGroundBrus h,0,0,this.Numb erOfLines,MaxVa l
);
for(int i=0;i<CounterAr ray.Count;i++)
{
Pen myPen = new Pen(Color.Red,1 );
//Draw all the vertical Lines
this.OffScreenD C.DrawLine(myPe n,i,MaxVal,i,Ma xVal - (int)CounterArr ay[i]);
}
//Put it on the screen
ClientDC.DrawIm age(this.OffScr eenBmp,0,0);
// Draw using the Region property of Panel1, works perfectly on first sighth
// but when you place this app behind another window, and bring it back to
the
// front, the graph looks kinda "garbled", I don't know why, can someone
explain this?
// Is this a bug ???
myPath = new GraphicsPath();
//Add all the vertical lines to the path
for(int i=0;i<CounterAr ray.Count;i++)
{
myPath.AddLine( i,this.panel1.H eight,i,this.pa nel1.Height -
(int)CounterArr ay[i]);
}
// Close the Path
myPath.AddLine( CounterArray.Co unt,this.panel1 .Height -
(int)CounterArr ay[CounterArray.Co unt -1],CounterArray.C ount,this.panel 1.Heig
ht);
this.panel1.Reg ion=new Region(myPath);