MrNymous Posted May 2, 2010 Posted May 2, 2010 Hay ...Got another Problem but i don't know how to fix it..This is my code...#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #NoTrayIcon GUICreate("TEST", 633, 447, 285, 315, BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER)) $Stats = GuiCtrlCreateButton("",351, 340, 104, 26, $BS_BITMAP) GUICtrlSetImage ($Stats,"1.bmp") GUISetState () ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WendI want to have 1.bmp as Button ... - i got this image in the same folder but this doesnt work ...Is somebody able to help me?1.bmp
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 SvenMawby,If you look at it in a Hex editor or in Paint, your BMP is actually a PNG. AutoIt only supports BMPs (and icons) on buttons.Open it in Paint, resave it as a BMP and it will display without problem, although you will need to resize your button to see it all. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Malkey Posted May 2, 2010 Posted May 2, 2010 This may give you some ideas.expandcollapse popup#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #NoTrayIcon Local $Bitmap, $sOpen, $w, $h, $Stats, $msg $sOpen = FileOpenDialog("Select file to convert", "", "Pictures (*.BMP;*.GIF;*.JPG;*.TIF;*.PNG)", 3) ;This is not all, but it is most of the supported formats If @error Then Exit ; Convert choosen image file to a .bmp file named "2.bmp" _GDIPlus_Startup() $Bitmap = _GDIPlus_ImageLoadFromFile($sOpen) $w = _GDIPlus_ImageGetWidth($Bitmap) $h = _GDIPlus_ImageGetHeight($Bitmap) _GDIPlus_ImageSaveToFile($Bitmap, "2.bmp") _GDIPlus_BitmapDispose($Bitmap) _GDIPlus_Shutdown() GUICreate("TEST", 633, 447, 285, 315, BitOR($WS_POPUP, $WS_BORDER, $WS_SIZEBOX), $WS_EX_COMPOSITED) GUISetFont(11, 800) GUICtrlCreateLabel("Drag window", 0, 0, 300, 20, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0xEEEEFF) $ExitLabel = GUICtrlCreateLabel("X", 300, 0, 20, 20, 0x0002) ; $SS_RIGHT) GUICtrlSetBkColor(-1, 0xEEEEFF) GUICtrlSetFont(-1, 14, 800) $Stats = GUICtrlCreateButton("", 30, 30, $w, $h, $BS_BITMAP) GUICtrlSetImage($Stats, "2.bmp") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $Stats Then MsgBox(0, "", "Button Pressed", 2) If $msg = $GUI_EVENT_CLOSE Or $msg = $ExitLabel Then ExitLoop WEnd FileDelete("2.bmp") ;Delete "2.bmp" file.
MrNymous Posted May 2, 2010 Author Posted May 2, 2010 Thank u Malkey^^ Paint 's save process doesnt realy convert it... i needed gimp .. but .. its okay... Yeah ... thank u .. works for me now..
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 SvenMawby,Paint 's save process doesnt realy convert itIt did for me, that is why I suggested it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
GEOSoft Posted May 2, 2010 Posted May 2, 2010 Funny^^You didn't by any chance just change the extension without selecting the file type when you used SaveAs did you? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
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