$H Windows.ph
$H commctrl.ph
Declare Handle ilist, tblist, hPic, icon, Btn1, Btn2, Btn3
Declare Long IconListe[], x, ende, xoff, yoff
Declare String Buchstaben[], buchstabe, w1, w2, w3, zeile1, zeile2, zeile3
zeile1 = "KALKULATION"
zeile2 = "ALKALI"
zeile3 = "UNIKAT"
w1 = ""
ende = 0
xoff = ~GetSystemMetrics(32)
yoff = ~GetSystemMetrics(4) + xoff
WindowTitle "Geschüttelte Buchstaben"
Window 780, 400
Btn1 = Create("Button", %HWnd, "Fertig", 600, 10, 60, 25)
Btn2 = Create("Button", %HWnd, "Neu", 600, 40, 60, 25)
Btn3 = Create("Button", %HWnd, "Ende", 600, 300, 60, 25)
DrawText 10, 5, "Bilde aus unten stehenden Buchstaben drei Wörter."
DrawText 10, 20, "Die Definitionen sollen dabei helfen."
DrawText 10, 35, "Ziehe mit der Maus die Buchstaben nacheinander in die Kästen."
DrawText 10, 50, "Wenn alle Wörter erstellt sind, drücke fertig zum Überprüfen."
InitIconListe()
DrawText 10, 150, "Kostenvoranschlag :"
RectAngle 200, 140, 680, 180
DrawText 10, 200, "laugenartige Verbindung :"
RectAngle 200, 190, 680, 230
DrawText 10, 250, "ein einzelnes Stück :"
RectAngle 200, 240, 680, 280
WhileNot Ende
WaitInput
If Mouse(20, 80 - 52, 112)
DoDragDrop(0)
ElseIf Mouse(70, 80 - 102, 112)
DoDragDrop(1)
ElseIf Mouse(120, 80 - 152, 112)
DoDragDrop(2)
ElseIf Mouse(170, 80 - 202, 112)
DoDragDrop(3)
ElseIf Mouse(220, 80 - 252, 112)
DoDragDrop(4)
ElseIf Mouse(270, 80 - 302, 112)
DoDragDrop(5)
ElseIf Mouse(320, 80 - 352, 112)
DoDragDrop(6)
ElseIf Mouse(370, 80 - 402, 112)
DoDragDrop(7)
ElseIf Mouse(420, 80 - 452, 112)
DoDragDrop(8)
ElseIf Mouse(470, 80 - 502, 112)
DoDragDrop(9)
ElseIf Mouse(520, 80 - 552, 112)
DoDragDrop(10)
ElseIf Clicked(Btn1)
' Fertig
If w1 = zeile1
DrawIcon tblist, 60, 700, 150
Else
DrawIcon tblist, 10, 700, 150
EndIf
If w2 = zeile2
DrawIcon tblist, 60, 700, 200
Else
DrawIcon tblist, 10, 700, 200
EndIf
If w3 = zeile3
DrawIcon tblist, 60, 700, 250
Else
DrawIcon tblist, 10, 700, 250
EndIf
ElseIf Clicked(Btn2)
' Neu
RectAngle 200, 140, 680, 180
RectAngle 200, 190, 680, 230
RectAngle 200, 240, 680, 280
DrawIcon tblist, 32, 700, 150
DrawIcon tblist, 32, 700, 200
DrawIcon tblist, 32, 700, 250
w1 = ""
w2 = ""
w3 = ""
ElseIf Clicked(Btn3)
ende = 1
EndIf
EndWhile
Proc InitIconListe
Declare Handle hIcon, tbpic
Buchstaben[] = Explode("A,L,T,U,K,I,L,A,O,K,N", ",")
MCls 32, 32, RGB(192, 192, 192)
ilist = Create("ImageList", 32, 32)
WhileLoop 0, 10
hPic = Create("hPic", 0, "&MEMBMP")
StartPaint hPic
UseFont "ARIAL", 24, 18, 1, 0, 0
DrawText 16, 4, Buchstaben[&LOOP], 6
EndPaint
ImageList("Add", ilist, hPic)
EndWhile
x = 20
WhileLoop 0, 10
DrawIcon ilist, &LOOP, x, 80
Inc x, 50
EndWhile
tbpic = Create("hSizedPic", 0, "TOOLBAR", 2368, 32, 0)
tblist = Create("ImageList", 32, 32, tbpic)
DrawIcon tblist, 32, 700, 150
DrawIcon tblist, 32, 700, 200
DrawIcon tblist, 32, 700, 250
DeleteObject tbpic
EndProc
Proc DoDragDrop
Parameters Long ix
buchstabe = Buchstaben[ix]
~ImageList_BeginDrag(ilist, ix, (%MouseX - xoff - %MouseX), (%MouseY - yoff - 100))
~ImageList_DragEnter(%HWnd, %MouseX, %MouseY)
While %MousePressed
~ImageList_DragMove(%MouseX, %MouseY)
EndWhile
~ImageList_EndDrag()
If Between(%MouseX, 200, 680, %MouseY, 140, 180)
w1 = w1 + buchstabe
DrawIcon ilist, ix, %MouseX , 145
ElseIf Between(%MouseX, 200, 680, %MouseY, 190, 230)
w2 = w2 + buchstabe
DrawIcon ilist, ix, %MouseX , 195
ElseIf Between(%MouseX, 200, 680, %MouseY, 240, 280)
w3 = w3 + buchstabe
DrawIcon ilist, ix, %MouseX , 245
EndIf
EndProc
DeleteObject ilist, tblist, hPic
End