mattfaust Posted January 9, 2009 Share Posted January 9, 2009 I have been trying to make a interface for a while now. I can make the buttons, and I can make them work. I can not make them look 1/2 way decent I would like to use a icon but I cant figure out how to make the background of the button transparent. So I decided just to use a image that would blend in with the window, But I get this ugly ring around the image from the buttons border. How can I remove this? CODE#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $button1, $button2, $button3, $button4 Local $button5, $buttonclose,$button6, $button7, $button8, $button9 Local $button10, $button11,$button12, $button13, $button14, $button15 Local $button16, $button17,$button18, $button19 GUICreate("test", 800, 480) GUICTRlCreatePic("backgrnd.gif",0,0,800,480) GuiCtrlSetState(-1,$GUI_DISABLE) $button1 = GUICtrlCreateButton ("1", 0, 0,80,80, $BS_BITMAP) GUICtrlSetImage ($button1, "button1.bmp") $button2 = GUICtrlCreateButton("2", 80, 00, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) GUICtrlSetBkColor(-1,000000) $button3 = GUICtrlCreateButton("3", 160, 00, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) GUICtrlSetBkColor(-1,000000) $button4 = GUICtrlCreateButton("4", 240, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $button5 = GUICtrlCreateButton("5", 320, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 32) $button6 = GUICtrlCreateButton("1", 400, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 5) $button7 = GUICtrlCreateButton("2", 480, 00, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) $button8 = GUICtrlCreateButton("3", 560, 00, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $button9 = GUICtrlCreateButton("4", 640, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $buttonclose = GUICtrlCreateButton("close", 720, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 28) $button10 = GUICtrlCreateButton("1", 0, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 5) $button11 = GUICtrlCreateButton("2", 80, 400, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) $button12 = GUICtrlCreateButton("3", 160, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $button13 = GUICtrlCreateButton("4", 240, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $button14 = GUICtrlCreateButton("5", 320, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 32) $button15 = GUICtrlCreateButton("1", 400, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 5) $button16 = GUICtrlCreateButton("2", 480, 400, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) $button17 = GUICtrlCreateButton("3", 560, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $button18 = GUICtrlCreateButton("4", 640, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $button19 = GUICtrlCreateButton("close", 720, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 28) GUISetState() ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $button1 Run("Notepad.exe") Case $button2 ; Case $button3 ; Case $button4 ; Case $button5 ; Case $buttonclose ExitLoop Case Else EndSwitch WEnd GUIDelete() EndFunc ;==>_Main Link to comment Share on other sites More sharing options...
rover Posted January 9, 2009 Share Posted January 9, 2009 I have been trying to make a interface for a while now. I can make the buttons, and I can make them work. I can not make them look 1/2 way decent I would like to use a icon but I cant figure out how to make the background of the button transparent. So I decided just to use a image that would blend in with the window, But I get this ugly ring around the image from the buttons border. How can I remove this?if you mean the dotted line around a selected button, I don't think that's changeable. try an imagelist for your buttons have a look at this post: Button with BMP and Text #572734 your example with a bitmap and icon button expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <GuiButton.au3> #include <GuiImageList.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $button1, $button2, $button3, $button4 Local $button5, $buttonclose,$button6, $button7, $button8, $button9 Local $button10, $button11,$button12, $button13, $button14, $button15 Local $button16, $button17,$button18, $button19 GUICreate("test", 800, 480) GUICTRlCreatePic("backgrnd.gif",0,0,800,480) GuiCtrlSetState(-1,$GUI_DISABLE) ;$button1 = GUICtrlCreateButton ("1", 0, 0,80,80, $BS_BITMAP) ;GUICtrlSetImage ($button1, "button1.bmp") ;single state image Bitmap $button1 = GUICtrlCreateButton("1", 0, 0, 80, 80) GUICtrlSetTip(-1, "Single bitmap imagelist") Local $hImagebtn1 = _GUIImageList_Create(32, 32, 5, 3);set to bitmap size required _GUIImageList_AddBitmap($hImagebtn1, @WindowsDir & "\pchealth\helpctr\System\blurbs\watermark_300x.bmp") _GUICtrlButton_SetImageList($button1, $hImagebtn1, 4); centered bitmap - see help file for icon alignment options $button2 = GUICtrlCreateButton("2", 80, 00, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) GUICtrlSetBkColor(-1,000000) $button3 = GUICtrlCreateButton("3", 160, 00, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) GUICtrlSetBkColor(-1,000000) $button4 = GUICtrlCreateButton("4", 240, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $button5 = GUICtrlCreateButton("5", 320, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 32) $button6 = GUICtrlCreateButton("1", 400, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 5) $button7 = GUICtrlCreateButton("2", 480, 00, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) $button8 = GUICtrlCreateButton("3", 560, 00, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $button9 = GUICtrlCreateButton("4", 640, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $buttonclose = GUICtrlCreateButton("close", 720, 0, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 28) $button10 = GUICtrlCreateButton("1", 0, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 5) $button11 = GUICtrlCreateButton("2", 80, 400, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) $button12 = GUICtrlCreateButton("3", 160, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $button13 = GUICtrlCreateButton("4", 240, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) $button14 = GUICtrlCreateButton("5", 320, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 32) $button15 = GUICtrlCreateButton("1", 400, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 5) $button16 = GUICtrlCreateButton("2", 480, 400, 80,80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 7) $button17 = GUICtrlCreateButton("3", 560, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) $button18 = GUICtrlCreateButton("4", 640, 400, 80, 80, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 23) ;$button19 = GUICtrlCreateButton("close", 720, 400, 80, 80, $BS_ICON) ;GUICtrlSetImage(-1, "shell32.dll", 28) ;single state image Icon $button19 = GUICtrlCreateButton("close", 720, 400, 80, 80) GUICtrlSetTip(-1, "Single icon imagelist") Local $hImagebtn2 = _GUIImageList_Create(32, 32, 5, 3) _GUIImageList_AddIcon($hImagebtn2, "shell32.dll", 28, True) _GUICtrlButton_SetImageList($button19, $hImagebtn2, 4); centered bitmap - see help file for icon alignment options GUISetState() ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $button1 Run("Notepad.exe") Case $button2 ; Case $button3 ; Case $button4 ; Case $button5 ; Case $buttonclose ExitLoop Case Else EndSwitch WEnd GUIDelete() EndFunc;==>_Main I see fascists... Link to comment Share on other sites More sharing options...
argumentum Posted January 9, 2009 Share Posted January 9, 2009 I have been trying to make a interface for a while now. I can make the buttons, and I can make them work. I can not make them look 1/2 way decent I would like to use a icon but I cant figure out how to make the background of the button transparent. So I decided just to use a image that would blend in with the window, But I get this ugly ring around the image from the buttons border. How can I remove this?#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 284, 149, 193, 133) $Label1 = GUICtrlCreateLabel("Click on this label", 8, 16, 107, 20) $Pic1 = GUICtrlCreatePic("C:\WINDOWS\Zapotec.bmp", 160, 8, 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Label2 = GUICtrlCreateLabel("or click on the pic.", 160, 120, 109, 20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Label1 MsgBox(0,"","this was a label you clicked on") Case $Pic1 MsgBox(0,"","this was a pic. you clicked on") EndSwitch WEnd hope it helps. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now