[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Image Transparency

Posted on 2003-10-27
7
Medium Priority
?
190 Views
Last Modified: 2010-05-01
Many thanks in advance!

I have a picture that has a red [ RGB(255,0,0) ] background color. How would I go about making it so that the red part is transparent? By transparent, I mean that the red part becomes see through. Thanks everybody!!
0
Comment
Question by:blizzdek
  • 2
4 Comments
 
LVL 11

Expert Comment

by:dbrckovi
ID: 9631848
I suggest converting this picture to GIF format and set the red color as transparent.
You can convert it to WMF format also, but it is for simple graphics only. It's not a bitmaped graphics format - it's vector graphics
0
 
LVL 3

Expert Comment

by:pg_india
ID: 9631901
i think you need a code in program vb

http://www.visualbasicforum.com/showthread.php?t=8118

try this link
0
 

Author Comment

by:blizzdek
ID: 9634627
Uhh... PG_India, all they do on that post is talk about relevant stuff but they never get around to answering the question... I just need code for image transparency; that's all...
0
 
LVL 3

Accepted Solution

by:
pg_india earned 280 total points
ID: 9639706
TransparentBlt API
mask image and use BitBlt

well these are the three functions which they have refereed to...Are you facing any problem in using these 3 functions.

I suggest better try with "TransparentBlt". This will work for u.

An example of this is:

'This project needs 2 pictureboxes
'Picturebox1 must contain a picture with a lot of white pixels (we're going to use white as transparent color)
Private Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean
Private Sub Form_Load()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Picture1.AutoSize = True
    'API uses pixels
    Picture1.ScaleMode = vbPixels
    Picture2.ScaleMode = vbPixels
End Sub
Private Sub Picture2_Paint()
    'If we don't call DoEvents first, our transparent image will be completely wrong
    DoEvents
    TransparentBlt Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbWhite
End Sub
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month18 days, 12 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question