MaxGUI 101 - Creating transparent buttons?

BlitzMax Forums/MaxGUI Module/MaxGUI 101 - Creating transparent buttons?

jonwalker(Posted 2009) [#1]
Hi All,

I'm having trouble creating a transparent button on a panel, in that I want the alpha channel of the PNG button image to be recognized. Is this possible? As at present it's showing a white border around the button, which doesn't look so great.

Thus far I have:

SuperStrict

Import MaxGui.Drivers

' Load up the Window.
' This is the window's "background".
Local pixmap_Background:TPixmap = LoadPixmapPNG ("D:\My Documents\My Pictures\Solar System/MessageBox.png")
' Create the window to the size of the background image.
Local Window1:TGadget = CreateWindow("Window1", 318, 143, pixmap_Background.width, pixmap_Background.height, Null, WINDOW_CLIENTCOORDS | WINDOW_CENTER)
' Create a panel on the Window so we can display the background image.
Local panel:TGadget = CreatePanel(0, 0, ClientWidth(Window1), ClientHeight(Window1), Window1, PANEL_ACTIVE)
SetGadgetLayout panel,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED
SetGadgetPixmap(panel, pixmap_Background, PANELPIXMAP_STRETCH)

' Load up the Button onto the Window (or rather panel)
' Button image.
Local Pixmap_Button1:TPixmap = LoadPixmapPNG ("D:/My Documents/My Pictures/Solar System/InGame/RemoveButton.png")
' Create the button on the window.
Local Button1:TGadget = CreateButton("Button1", 33, 38, Pixmap_Button1.width, Pixmap_Button1.height, panel, BUTTON_PUSH)
' Set the button image to the button itself.
SetGadgetPixmap(Button1, Pixmap_Button1, GADGETPIXMAP_ICON | GADGETPIXMAP_NOTEXT)

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case Window1
					End
			End Select

	End Select
Forever
Any ideas how I can make the pixmap of the button obey it's alpha channel on the button?

Thanks, Jon


SebHoll(Posted 2009) [#2]
I couldn't really make out the button as it was a little too small for the graphics I was using, but it appears to be working as expected here:



Which version of MaxGUI/BlitzMax and Windows are you running?

P.S. here are the graphics:




Arowx(Posted 2010) [#3]
Same problem here just getting black borders!

http://www.blitzbasic.com/Community/posts.php?topic=88600#1006166

Running on Windows Vista 32bit