Help with transparant images
Help with transparant images
Help with transparant images
Help with transparant images
Help with transparant images
Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images
Help with transparant images Help with transparant images
Help with transparant images
Go Back  Xtreme Visual Basic Talk > > > Help with transparant images


Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2010, 01:10 PM
mrmrblake mrmrblake is offline
Newcomer
 
Join Date: Feb 2010
Posts: 2
Unhappy Help with transparant images


Hi,

I am trying to make a game which basiclly lets you shoot ducks.

i have a picture as a background (set as form image)

i then have picturebox's with ducks flying flying around you shoot them the disapear etc.

my problem is the image. i have a picture of a duck and a blue square round it. and i would liketo make it transparant because birds dont fly with blue squares.

below is an image to illistrate my problem

i have tried adding transparent background, transparant key etc
Attached Images
File Type: png help.png (186.5 KB, 14 views)
Reply With Quote
  #2  
Old 02-01-2010, 04:35 PM
snarfblam's Avatar
snarfblamHelp with transparant images snarfblam is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Apr 2005
Location: USA
Posts: 896
Default

I recommend using an color that stands out to represent transparent areas. Magenta (#FFFF00) is the most commonly used color for this. This would be your transparency key of course. You can use the Bitmap.MakeTransparent function to make your transparency key become transparent.
Code:
Dim bmp As Bitmap = DirectCast(someImage, Bitmap)

' Clear magenta areas
bmp.MakeTransparent(Color.Magenta)
' - or -   A common approach is to use the top left pixel to specify the transparency key
bmp.MakeTransparent(bmp.GetPixel(0,0))
Once you've done this, you need to set the BackColor property of the PictureBox to Color.Transparent.

Here's the problem: using PictureBoxes this way creates a glitchy result. You might not be too happy with the way it comes out. An alternative would be to use more advanced graphics techniques such as GDI+, WPF, XNA, or DirectX (in order of increasing power/difficulty).
__________________
C# _VB.NET _
Reply With Quote
  #3  
Old 02-03-2010, 01:31 PM
mrmrblake mrmrblake is offline
Newcomer
 
Join Date: Feb 2010
Posts: 2
Default

Hi, Marble Eater

Thanks for your post. i think ill have a go at the alternatives due to the glitching result thanksf or your post

thanks
Reply With Quote
Reply

Tags
images, transparant


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Help with transparant images
Help with transparant images
Help with transparant images Help with transparant images
Help with transparant images
Help with transparant images
Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images Help with transparant images
Help with transparant images
Help with transparant images
 
Help with transparant images
Help with transparant images
 
-->