You last visited: Today at 16:16
Advertisement
Problem mit GUICtrlSetImage()
Discussion on Problem mit GUICtrlSetImage() within the AutoIt forum part of the Coders Den category.
07/16/2011, 01:13
#1
elite*gold: 0
Join Date: Jun 2009
Posts: 121
Received Thanks: 13
Problem mit GUICtrlSetImage()
Hallo,
das Problem ist gelöst!
Es ist nun Downloadbar im Anhang.
Dies ist natürlich wieder ein Übungsscript also bitte net rumheulen, dass es kein Zweck odda so hat!
Attached Files
GeldRechner.rar
(734.2 KB, 5 views)
07/16/2011, 12:36
#2
elite*gold: 0
Join Date: Apr 2008
Posts: 1,079
Received Thanks: 438
Syntax fehler seh ich jetzt keinen. Probier mal rum indem du die Buttons/bmp vertauscht. Wandert der Fehler mit?
07/16/2011, 13:30
#3
elite*gold: 0
Join Date: Jun 2009
Posts: 121
Received Thanks: 13
Wenn ich des Bild von dem 10€ schein da hin hau, dann zeigts den auch an (2 mal hald)...
am bild selbst kann es iwie nich liegen. hab jetz schonma die button funktionen gemacht, des zählt alles richtig....
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Break(0)
DirCreate("C:\Geld\")
FileSetAttrib("C:\Geld\","+H")
FileInstall("C:\0,01.bmp","C:\Geld\")
FileInstall("C:\0,02.bmp","C:\Geld\")
FileInstall("C:\0,05.bmp","C:\Geld\")
FileInstall("C:\0,10.bmp","C:\Geld\")
FileInstall("C:\0,20.bmp","C:\Geld\")
FileInstall("C:\0,50.bmp","C:\Geld\")
FileInstall("C:\1.bmp","C:\Geld\")
FileInstall("C:\2.bmp","C:\Geld\")
FileInstall("C:\5.bmp","C:\Geld\")
FileInstall("C:\10.bmp","C:\Geld\")
FileInstall("C:\20.bmp","C:\Geld\")
FileInstall("C:\50.bmp","C:\Geld\")
FileInstall("C:\100.bmp","C:\Geld\")
FileInstall("C:\200.bmp","C:\Geld\")
FileInstall("C:\500.bmp","C:\Geld\")
$Form1 = GUICreate("GeldRechner", 623, 542, 189, 130)
GUISetBkColor(0xFFFFFF)
$Button1 = GUICtrlCreateButton("Button1", 8, 8, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\0,01.bmp", -1)
$Button2 = GUICtrlCreateButton("Button2", 128, 8, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\0,02.bmp", -1)
$Button3 = GUICtrlCreateButton("Button3", 248, 8, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\0,05.bmp", -1)
$Button4 = GUICtrlCreateButton("Button4", 368, 8, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\0,10.bmp", -1)
$Button5 = GUICtrlCreateButton("Button5", 488, 8, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\0,20.bmp", -1)
$Button6 = GUICtrlCreateButton("Button6", 8, 128, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\0,50.bmp", -1)
$Button7 = GUICtrlCreateButton("Button7", 128, 128, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\1.bmp", -1)
$Button8 = GUICtrlCreateButton("Button8", 248, 128, 113, 113, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\2.bmp", -1)
$Button9 = GUICtrlCreateButton("Button9", 8, 248, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\5.bmp", -1)
$Button10 = GUICtrlCreateButton("Button10", 152, 248, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\10.bmp", -1)
$Button11 = GUICtrlCreateButton("Button11", 296, 248, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\20.bmp", -1)
$Button12 = GUICtrlCreateButton("Button12", 440, 248, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\50.bmp", -1)
$Button13 = GUICtrlCreateButton("Button13", 8, 344, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\100.bmp", -1)
$Button14 = GUICtrlCreateButton("Button14", 152, 344, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\200.bmp", -1)
$Button15 = GUICtrlCreateButton("Button15", 296, 344, 129, 89, BitOR($BS_NOTIFY,$BS_BITMAP))
GUICtrlSetImage(-1, "C:\Geld\500.bmp", -1)
$Label1 = GUICtrlCreateLabel("Kosten:", 16, 472, 65, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("0.00", 16, 504, 100, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Radio2 = GUICtrlCreateRadio("Bezahlt", 144, 448, 81, 17)
$Radio1 = GUICtrlCreateRadio("Kosten", 16, 448, 81, 17)
$Label3 = GUICtrlCreateLabel("Bezahlt:", 144, 472, 70, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("0.00", 144, 504, 100, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("Rückgeld:", 280, 472, 84, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("0.00", 280, 504, 100, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button16 = GUICtrlCreateButton("Zurücksetzen!", 440, 456, 153, 65)
GUICtrlSetFont(-1, 12, 800, 0, "Comic Sans MS")
$Label7 = GUICtrlCreateLabel("€", 82, 504, 15, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("€", 210, 504, 15, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("€", 350, 504, 15, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
MsgBox(64,"Löschen","Bilder werden gelöscht!")
FileDelete("C:\Geld\*.*")
DirRemove("C:\Geld\")
Exit
Case $Button16
GUICtrlSetData($Label6,"0.00")
GUICtrlSetData($Label4,"0.00")
GUICtrlSetData($Label2,"0.00")
Case $Button1
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 0.01)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 0.01)
EndIf
Case $Button2
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 0.02)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 0.02)
EndIf
Case $Button3
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 0.05)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 0.05)
EndIf
Case $Button4
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 0.10)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 0.10)
EndIf
Case $Button5
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 0.20)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 0.20)
EndIf
Case $Button6
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 0.50)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 0.50)
EndIf
Case $Button7
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 1.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 1.00)
EndIf
Case $Button8
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 2.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 2.00)
EndIf
Case $Button9
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 5.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 5.00)
EndIf
Case $Button10
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 10.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 10.00)
EndIf
Case $Button11
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 20.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 20.00)
EndIf
Case $Button12
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 50.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 50.00)
EndIf
Case $Button13
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 100.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 100.00)
EndIf
Case $Button14
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 200.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 200.00)
EndIf
Case $Button15
If GUICtrlRead($Radio1) = 1 Then
$Bezahlt = GUICtrlRead($Label2)
GUICtrlSetData($Label2,$Bezahlt + 500.00)
EndIf
If GUICtrlRead($Radio2) = 1 Then
$Bezahlt = GUICtrlRead($Label4)
GUICtrlSetData($Label4,$Bezahlt + 500.00)
EndIf
EndSwitch
Sleep(30)
$Rueckgeld1 = GUICtrlRead($Label2)
$Rueckgeld2 = GUICtrlRead($Label4)
$Neuerwert = $Rueckgeld2 - $Rueckgeld1
GUICtrlSetData($Label6,$Neuerwert)
WEnd
07/16/2011, 13:51
#4
elite*gold: 0
Join Date: Apr 2008
Posts: 1,079
Received Thanks: 438
Quote:
Originally Posted by
Tobolobo
Wenn ich des Bild von dem 10€ schein da hin hau, dann zeigts den auch an (2 mal hald)...
am bild selbst kann es iwie nich liegen. hab jetz schonma die button funktionen gemacht, des zählt alles richtig....
Hmmm, wenn der Fehler mit den Bild mitwandert, dann muss es das Bild sein. Mal probiern das Bild nochmal neu zu erstellen/runterzuladen. Stimmt das format? Pixelgröße? et cetera.
07/16/2011, 13:53
#5
elite*gold: 0
Join Date: Jun 2009
Posts: 121
Received Thanks: 13
die sind alle gleich groß gleich konvertiert...
bild hab ich schon 2 mal neu heruntergeladen
ich glaube du hast des falsch verstanden, wenn ich den 10€ schein auf den button vom 5€ schein leg, dann zeigts beide 10 euro scheine richtig an.
ich probier weiter rum...
€: Der fehler wandert mit dem Bild mit...
Bitte Helft mir. ich stell die daten jetz als anhang mit rein
07/16/2011, 15:17
#6
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
das muss wie schon gesagt an dem 5euro schein selbst liegen.
scheint als wenn autoit dieses bild nicht darstelln kann.
Edit:
vergleicht man die datei binär gesehen mit den anderen ist ein eindeutiger unterschied festzustellen:
07/16/2011, 20:16
#7
elite*gold: 0
Join Date: Jun 2009
Posts: 121
Received Thanks: 13
Fertig
ich hab jetz einfach ne andere bilder reihe genommen nun isses fertig und funkt.
download im anhang!
All times are GMT +2. The time now is 16:16 .