?
Solved

Setting Mask (Transparent) Colour in PictureBox

Posted on 2007-12-02
1
Medium Priority
?
2,520 Views
Last Modified: 2012-06-21
In VB6, one could set the Mask colour of a PictureBox (or was it an ImageBox?) to make a specific colour transparent (normally this was set to the picture's background colour). I can't seem to find this property in VB 2005's PictureBox control. Any ideas?
0
Comment
Question by:SETP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 20392041
Hi SETP;

In VB .Net 2005 the transparent color is now part of the Bitmap image itself and not the PictureBox object. The sample code below shows hot to load a gif image into a picture box with a transparent color of red = 7, green = 15 and blue = 0 or you could use a Color.ColorName as also shown.

Fernando
        Dim bMap As Bitmap = CType(Bitmap.FromFile("C:\Temp\image001.gif"), Bitmap)
        bMap.MakeTransparent(Color.FromArgb(7, 14, 0))
        PictureBox1.Image = bMap
 
Or
 
        Dim bMap As Bitmap = CType(Bitmap.FromFile("C:\Temp\image001.gif"), Bitmap)
        bMap.MakeTransparent(Color.Yellow)
        PictureBox1.Image = bMap

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

770 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