Graphics: using Alpha Color - Mouse Rectangle rendered

Aug 27 2004 1:03 PM
Dear friends! I have a strange problem with C# and the Graphics-class. My Form contains a pictureBox, on which a black and a red rectangle is drawn as soon as the user clicks on it. The Red Rectangle uses Color (200,255,0,0), so an Alpha value for transparency. The result can be seen here: Link:http:\\www.bluecommerce.net\error.jpg The code is: Code: private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { SolidBrush pen1 = new SolidBrush(Color.FromArgb(200,255,0,0)); SolidBrush pen2 = new SolidBrush(Color.Black); Graphics Graph = userControl1.CreateGraphics(); Graph.FillRectangle(pen2,e.X - 50,e.Y - 50,100,100); Graph.FillRectangle(pen1,e.X - 50,e.Y - 50,100,100); } As you can see, the red rectangle is NOT rendered in the vincinity of the Mouse cursor (the mouse icon), you can see the black Rectangle through it. This happens ONLY if the Red Rectangle has an alhpa value which is NOT 0 or 255. 0 and 255 work of course. This error happens only on my computer and a similar one (both have Windows 2000 and a Matrox G450 Millenium graphics card), on another computer with WinXP and another graphics card the same code works perfectly. All current drivers and ServicePacks fpr GDI, GDI+, Windows 2000, Visual Studio .NET 1.0 (Service Pack 2) are installed. Now, I would like to know if the error occures because of the a.) Graphics card b.) Windows 2000 c.) Visual Studio .NET d.) GDI+ e.) my fault? Who already encountered something similar and knows help? I've already spent hours in searching at msdn and google, but did not find anything. Thank you very much for your help. Kind Regards Marcel

Answers (1)