TextColorButton

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Def Opponent(1) (256^3)-@&(1)'Komplementärfarbe berechnen
cls
var bt1&=TextColorButton(%hwnd,"Beispiel",0,RND(256^3),RND(256^3),10,10,150,25)
var bt2&=TextColorButton(%hwnd,"Beispiel",1,RND(256^3),RND(256^3),10,40,150,40)
var bt3&=TextColorButton(%hwnd,"Beispiel",2,RND(256^3),RND(256^3),10,85,250,70)

while 1

    sleep 300
    Randomize
    SetTextColorButton(bt1&,"Beispiel",0,RND(256^3),RND(256^3))
    SetTextColorButton(bt2&,"Beispiel",1,RND(256^3),RND(256^3))
    SetTextColorButton(bt3&,"Beispiel",2,RND(256^3),RND(256^3))

Endwhile

Proc TextColorButton

    Parameters hdl&,text$,ausr&,bgcol&,textcol&,x1&,y1&,x2&,y2&
    var picbt&=Create("PicButton",hdl&,0,x1&,y1&,x2&,y2&)
    SetTextColorButton(picbt&,text$,ausr&,bgcol&,textcol&)
    Return picbt&

EndProc

Proc SetTextColorButton

    Parameters hdl&,text$,ausr&,bgcol&,textcol&
    var hpic&=Create("hNewPic", width(hdl&)-4, height(hdl&)-4, bgcol&)
    StartPaint hpic&
    UseFont "Arial",(height(hdl&)-4)/1.3125,0,1,0,0
    TextColor textcol&,-1
    DrawText (height(hdl&)-4)/5, (height(hdl&)-4)/10, width(hpic&)-((height(hdl&)-4)/5), height(hpic&)-((height(hdl&)-4)/10), text$, ausr&
    EndPaint
    Sendmessage(hdl&,$F7 | 247,0,hpic&)
    deleteobject hpic&
    Return 1

EndProc