Jump to content

Recommended Posts

Posted

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
Wend

I 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
Posted

SvenMawby,

If you look at it in a Hex editor or in Paint, your BMP is actually a PNG. :idea: 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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted

This may give you some ideas.

#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.
Posted

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
Posted

SvenMawby,

  Quote

Paint 's save process doesnt realy convert it

It did for me, that is why I suggested it. :idea:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted

  On 5/2/2010 at 4:00 PM, 'SvenMawby said:

Funny^^

You didn't by any chance just change the extension without selecting the file type when you used SaveAs did you?

George

  Reveal hidden contents
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!"

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...