solokin1 Posted March 5, 2003 Posted March 5, 2003 Hi, Thanks for the info on creating a bitmap image in memory, and now I have a question on how to draw an image transparently on a picture box, using drawimage. What I have in mind is something like the following function: TransBlt(srcImage As Image, srcRect aS Rectangle, destImage As Image, destRect As Rectangle, transColor AS Color) What would be the source code for this? Thanks a lot, Solokin1 Quote
bpayne111 Posted March 6, 2003 Posted March 6, 2003 (edited) Well when you make it transparent you will see the back of your picturebox instead of the form itself... Refer to my post on Transparent Graphic on Top for some info in the area if you will to make a certain color transparent in the bitmap class you can use the GetPixel method and the Make Transparent method. Use get pixel to get the color of a pixel that contains the color you wish to make transparent (in most cases GetPixel(1,1) works because the outside of the image is what you wish to make transparent however this doens't always hold true of course The following code is an example... Public Some Sub() Dim b as Bitmap = New Bitmap("myfile") b.MakeTransparent(b.GetPixel(1,1)) picturebox1.Image = b 'not you will not be able to see the form, you should dump the picturebox and use the System.Drawing.Graphics object for that (i just learned that myself :)) good luck Edited March 6, 2003 by divil Quote i'm not lazy i'm just resting before i get tired.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.