Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GDI+ how to increase transparancy
Message
From
31/08/2012 04:43:23
 
 
To
30/08/2012 05:04:57
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01551689
Message ID:
01552113
Views:
61
>>>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
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform