Guidance
指路人
g.yi.org
software / rapidq / examples / Network / qmeteo / rollover.inc

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  


'bouton rollover


     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     '' You can extend any QObject
  '-- New Properties, you can also add components


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



'#################################################
'mes subs
      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 souris dessus
      SUB over
  'verifie si déjà dessus
       IF rolover.timer1.enabled=1 THEN EXIT SUB
   'sinon déclenche le timer
   'affiche l'image over
   'et la couleur de font du label
       rolover.timer1.enabled=1
       rolover.imageoff.visible=0
       rolover.imageon.visible=1
       rolover.label.font.COLOR=rolover.Captioncoloron
      END SUB
'######################################################
'sub oute du bouton  test si la souris est toujours dessus
      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
'##################################################

  '-- There are no protected methods, but you should let the user know anyway.
  '-- PROTECTED (meaning you shouldn't directly call it in your program).

  'mes propriétés

      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

   '-- Inherited Events (sorry, can't create any new events)
  '-- The user can still override these events, but it's not a good idea.
 '##################################################
      EVENT timer1.Ontimer
       rolover.oute
      END EVENT


'######################################################
  '-- Default values
      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

掌柜推荐
 
 
¥860.00 ·
 
 
¥900.00 ·
 
 
¥810.00 ·
 
 
¥317.00 ·
 
 
¥1,370.00 ·
 
 
¥660.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:49:40