Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


ImageButton Background Transparent Issue


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-26-2007, 04:04 PM
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default ImageButton Background Transparent Issue

I have a Image button loaded with a PNG image 64x64 pix. At run time the image will show a gray background. Transparent property is set to TRUE.

When I click the image Button the Image background is then transparent, which should it been when the program started.

What do I need to set in order in the imageButton property (if any) so it does not have a gray background at start up?

You help will be appreciated.

Thank You.
Reply With Quote
  #2 (permalink)  
Old 12-26-2007, 06:04 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Hi,

PNG images have an alpha cannel, wich control their transparencie...
Try to use a BMP version of the same image...
As I understand, the transparency feature works by getting the o,o (x,y)pixel color, and then set them all to the same collor as the background...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #3 (permalink)  
Old 12-26-2007, 06:17 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello gs4322
You must know that the upper left pixel determines the transparency color.
If you have placed your button with the Designer you can select or unselect the Tranparent property which defines the state at programm start.
If you have placed the control by code in the App_Start routine you should set the Transparent property to true or false depending on what you need.
I have used this method with buttons with white as transparency color and a black frame around but white pixels in the corner because it determines the transparency color with bitmaps.

Klaus
Switzerland
Reply With Quote
  #4 (permalink)  
Old 12-26-2007, 07:32 PM
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default

Guys thanks for the quick response, you guys are great..

I converted the image to BMP, same problem. Can you share some code example here:

How to set the pixel transparency (X,Y) pixel in the image property.

I do have transparency set to TRUE.

I have the same issue with (PNG, GIF and now BMP), I want to use PNG because they smaller, these are converted ICON to PNG..



Thanks
Reply With Quote
  #5 (permalink)  
Old 12-26-2007, 07:33 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Can u upload the project as is...?
could then help more efectively...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #6 (permalink)  
Old 12-26-2007, 08:35 PM
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default

I found the problem, when I resized the PNG images I must lost some property format or did not save correctly. The original PNG was 128x128 pix. Anyway, I used the original and resize the ImageBtn to 48x48pix and the image looks fine now.

This problem started wanting to display ICONS (ico) formats.

Thanks for all your help..
Reply With Quote
  #7 (permalink)  
Old 12-26-2007, 10:04 PM
Junior Member
 
Join Date: Dec 2007
Posts: 16
Default

well guys, I thought I had the problem fixed with the images resizing, still have the same issue.

Attached is the sample code with the images, you can see the edges of the image in gray..

I need to have a panel on top of the form because I may have different panels.

Thanks..

gs4322
Attached Files
File Type: zip show.zip (68.9 KB, 16 views)
Reply With Quote
  #8 (permalink)  
Old 12-27-2007, 05:28 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

The ImageButton transparent parts show the forms colors.
You will need to remove the image and the panel and draw the image on the form.
See the attached file.
Attached Files
File Type: zip show2.zip (68.7 KB, 22 views)
Reply With Quote
  #9 (permalink)  
Old 12-27-2007, 06:33 AM
Senior Member
 
Join Date: Jul 2007
Posts: 147
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Erel your show2.sbp is just a blank template.
__________________
Using 6.30
dennishea
Reply With Quote
  #10 (permalink)  
Old 12-27-2007, 08:47 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

I have modified your program with 4 ImageButtons.
The upper two's parent control is Form1
the lower two's parent control is Panel1
the left two with .png images
the right two with .bmp images
And Button1 to toggle between transparent ant not transparent.

As you can see, the upper two buttons show the Form1 background color
the lower two show the Panel1 background color.

An image control can not be a parent control so the image button cannot show it's image.

A panel control can be a parent control but doesn't have an image property.

So, as Erel told, you must put the image on Form1 ant the image buttons parent control must also be Form1.

The top right buttons transparent color is almost the same as the Form1 background color that's why there seems not be any change in toggling.

Hope this explains how this works.

Klaus
Switzerland
Attached Files
File Type: zip Show3.zip (79.5 KB, 24 views)
Reply With Quote
Reply



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
AddEvent & ImageButton in IDE agraham Bug Reports 1 09-10-2008 09:31 PM
ImageButton MouseOver superbabicka Questions & Help Needed 0 06-29-2008 09:19 PM
imagebutton error kolbe Questions & Help Needed 3 03-11-2008 03:20 PM
transparent background,label cdeane Questions & Help Needed 4 09-20-2007 06:45 AM
Label with transparent background BerndB Basic4ppc Wishlist 6 07-03-2007 04:00 PM


All times are GMT. The time now is 05:34 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0