Transparent bitmap
-
To draw a transparent bitmap on the form I use the old trick from VC++ which is to draw a bitmap that is stored in ImageList. When you set TransparentColor property of ImageList to the color of the bitmap's transparency color, the bitamp is drawn transparently on the form. My problem is that this doesn't work when there is another bitmap on the form behind my bitmap. I want to see this another bitmap through the transparent bitmap. In VC++ a was using SRCCOPY, SRCAND and SRCINVERT in BitBlt(). I don't see any equivalent of raster operation codes in C#. Any ideas? Jerzy
-
To draw a transparent bitmap on the form I use the old trick from VC++ which is to draw a bitmap that is stored in ImageList. When you set TransparentColor property of ImageList to the color of the bitmap's transparency color, the bitamp is drawn transparently on the form. My problem is that this doesn't work when there is another bitmap on the form behind my bitmap. I want to see this another bitmap through the transparent bitmap. In VC++ a was using SRCCOPY, SRCAND and SRCINVERT in BitBlt(). I don't see any equivalent of raster operation codes in C#. Any ideas? Jerzy
Bitmap bmp = Bitmap.FromFile( strFilename ); bmp.MakeTransparent( clrTransparentColorInBitmap ); Graphics g = GetGraphicsObjectToPaintOn(); g.DrawImage( bmp, x, y );
Took a bit of searching to find it :( James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978 -
Bitmap bmp = Bitmap.FromFile( strFilename ); bmp.MakeTransparent( clrTransparentColorInBitmap ); Graphics g = GetGraphicsObjectToPaintOn(); g.DrawImage( bmp, x, y );
Took a bit of searching to find it :( James Sonork ID: 100.11138 - Hasaki "Smile your little smile, take some tea with me awhile. And every day we'll turn another page. Behind our glass we'll sit and look at our ever-open book, One brown mouse sitting in a cage." "One Brown Mouse" from Heavy Horses, Jethro Tull 1978Thanks James Yes, it's a nice alternative to was I was doing (using ImageList class). But I forgot to explain that I was using PictureBox control not device context. I still wonder if I could use two PictureBox controls, one transparent over the other. Thanks again Jerzy