>>>Hi all,
>>>
>>>I've got PNG images that I want to use a toolbar buttons, but in stead of providing 2 images (normal and disabled) I want to create the disabled image by making the image half transparant. Does anyone know for to get started on this by using GDI+?
>>>
>>
>>See CesarS blog on foxite. It is loaded with various GDI+ examples. However it might be easier to prepare two bitmaps ready and have them flipped at run time. I personally use scalled down ThemedControls solution for buttons (flipping bitmaps) and it works like a charm.
>>
>>HTH
>>Sergio
>
>Thanks sergio, I found an article of Cesar on the UT which led to this:
>
>
WITH _SCREEN.System.Drawing
> loBitmap = .Bitmap.New(cTempFile)
> loNewBitmap = .Bitmap.New(loBitmap.Width, loBitmap.Height)
> * Create a Graphics object to be able to draw in the bitmap
> loGfx = .Graphics.FromImage(loNewBitmap)
> loClrMatrix = .Imaging.ColorMatrix.New( ;
> 1 , 0, 0, 0, 0, ;
> 0 , 1, 0, 0, 0, ;
> 0 , 0, 1, 0, 0, ;
> 0 , 0, 0, .4, 0, ;
> 0 , 0, 0, 0, 1)
> loAttr = .Imaging.ImageAttributes.New()
> loAttr.SetColorMatrix(loClrMatrix)
> loRect = .Rectangle.New(0,0,loBitmap.Width, loBitmap.Height)
> loGfx.DrawImage(loBitmap, loRect, loRect, .GraphicsUnit.Pixel, loAttr)
> loNewBitmap.Save(cDimFile, .Imaging.ImageFormat.png)
>ENDWITH
>
Wanted to try this myself. Where do you read original bitmap to be deemed ?
Or you do it in some previous code. Why don't you post picture of result ?
TIA
Sergio