TYPE POINTAPI
X AS LONG
Y AS LONG
END TYPE
DECLARE FUNCTION GetCursorPos LIB "user32" ALIAS "GetCursorPos" ( lpPoint AS POINTAPI) AS LONG
DECLARE FUNCTION WindowFromPoint LIB "user32" ALIAS "WindowFromPoint"(BYVAL xPoint AS LONG, BYVAL yPoint AS LONG) AS LONG
DECLARE SUB event_change
TYPE rolover EXTENDS QPANEL
public:
OnClick AS EVENT (event_change)
CAPTION AS STRING PROPERTY SET SetCaption
Centrer AS INTEGER PROPERTY SET Setcentrer
Captionleft AS INTEGER PROPERTY SET SetCaptionleft
Captiontop AS INTEGER PROPERTY SET SetCaptiontop
Captioncoloroff AS INTEGER PROPERTY SET SetCaptioncoloroff
Captioncoloron AS INTEGER PROPERTY SET SetCaptioncoloron
canva AS QCANVAS
timer1 AS QTIMER
imageoff AS QIMAGE
imageon AS QIMAGE
label AS QLABEL
SUB centrelabel
IF rolover.centrer=1 THEN
rolover.label.left=rolover.width/2 -(rolover.label.width/2)
rolover.label.top=rolover.height/2 -(rolover.label.height/2)
EXIT SUB
END IF
rolover.label.left=rolover.Captionleft
rolover.label.top=rolover.Captiontop
END SUB
SUB over
IF rolover.timer1.enabled=1 THEN EXIT SUB
rolover.timer1.enabled=1
rolover.imageoff.visible=0
rolover.imageon.visible=1
rolover.label.font.COLOR=rolover.Captioncoloron
END SUB
SUB oute
DIM posm AS pointapi
DIM success AS LONG
DIM hwnd AS LONG
success=GetCursorPos(posm)
hwnd= WindowFromPoint(posm.x,posm.y)
IF hwnd=rolover.handle THEN
rolover.label.font.COLOR=rolover.Captioncoloron
EXIT SUB
END IF
rolover.imageoff.visible=1
rolover.imageon.visible=0
rolover.label.font.COLOR=rolover.Captioncoloroff
rolover.timer1.enabled=0
END SUB
PROPERTY SET SetCaptioncoloroff (Captioncoloroff AS INTEGER)
rolover.Captioncoloroff=Captioncoloroff
END PROPERTY
PROPERTY SET SetCaptioncoloron (Captioncoloron AS INTEGER)
rolover.Captioncoloron=Captioncoloron
END PROPERTY
PROPERTY SET SetCaption (CAPTION AS STRING)
rolover.label.CAPTION=CAPTION
rolover.centrelabel
END PROPERTY
PROPERTY SET SetCentrer (Centrer AS INTEGER)
rolover.centrer=centrer
rolover.centrelabel
END PROPERTY
PROPERTY SET SetCaptionleft (Captionleft AS INTEGER)
rolover.captionleft=captionleft
rolover.centrelabel
END PROPERTY
PROPERTY SET SetCaptiontop (Captiontop AS INTEGER)
rolover.captiontop=captiontop
rolover.centrelabel
END PROPERTY
EVENT timer1.Ontimer
rolover.oute
END EVENT
CONSTRUCTOR
imageoff.autosize=1
imageoff.transparent=1
imageoff.PARENT=rolover
label.CAPTION=rolover.CAPTION
timer1.enabled=0
timer1.interval=100
BevelWidth=0
Captiontop=0
Captionleft=0
COLOR=255
onclick=0
centrer=1
imageon.autosize=1
imageon.transparent=1
imageon.PARENT=rolover
imageon.visible=0
Height = rolover.imageoff.height
Width = rolover.imageoff.width
label.PARENT =rolover
label.transparent=1
label.Autosize =1
label.left=rolover.width/2 -(rolover.label.width/2)
label.top=rolover.height/2 -(rolover.label.height/2)
Captioncoloron=RGB(255,255,255)
Captioncoloroff=RGB(0,0,255)
label.font.COLOR=rolover.Captioncoloroff
canva.PARENT=rolover
END CONSTRUCTOR
EVENT canva.Onmousemove
rolover.centrelabel
rolover.over
END EVENT
EVENT canva.OnClick
IF rolover.OnClick<>0 THEN
CALLFUNC rolover.OnClick
END IF
END EVENT
EVENT canva.onpaint
rolover.Height = rolover.imageoff.height
rolover.Width = rolover.imageoff.width
rolover.captionleft=rolover.captionleft
rolover.captiontop=rolover.captiontop
rolover.captioncoloroff=rolover.captioncoloroff
rolover.centrelabel
rolover.oute
END EVENT
END TYPE
|