Guidance
指路人
g.yi.org
software / rapidq / Examples / QObject / Object / Doc French / QSkinBtn.html

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

  
Appendix A: QSkinBtn  
Documentation composant par D.Glodt (c)2003 Appendix A: QSkinBtn

QSkinBtn Composant

QSkinBtn est un composant bouton de type skin.

QSkinBtn Proprietés
Champs Type L/E Défaut





btUp QBITMAP L/E
Image bmp pour l'etat relaché du bouton.
btDown QBITMAP L/E
Image bmp pour l'état enfoncé du bouton.
btEnable QBITMAP L/E
Image bmp pour l'etat disable du bouton.
mode SHORT L/E 0
Mode de fonctionnement du bouton.
Mode a 0:Etat identique a un bouton de type QButton.
Mode a 1:le bouton reste a l'état enfoncé a l'activation.
Mode a 2:le bouton change d'état a chaque activation.
down BOOLEAN L/E FALSE
Etat enfoncé du bouton.
Enabled BOOLEAN L/E TRUE
Parent QFORM,QPANEL,QTABCONTROL E
Left INTEGER L/E 0
Top INTEGER L/E 0

QSkinBtn Methodes

Methode Type Description Parametres





QSkinBtn Evenements

Evenement Type Declenchement Parametres





OnClick Click sur le bouton 0

QSkinBtn Exemples

$typecheck on 
$optimize on 
$include "Rapidq.inc$include "QFuncLib.inc$include "Object\QSkin.inc$include "Object\QSkinBtn.inc$include "Object\QTextBtn.inc$include "Object\QFlashLabel.inc$include "Object\QVuMeter.inc$include "Object\QVideo.inc"

$resource img as "skin3.bmp" ' fichier bitmap d'habillage  
$resource play1 as "play1.bmp$resource play2 as "play2.bmp$resource stop1 as "stop1.bmp$resource stop2 as "stop2.bmp$resource pause1 as "pause1.bmp$resource pause2 as "pause2.bmp$resource back1 as "back1.bmp$resource back2 as "back2.bmp$resource fwd1 as "foreward1.bmp$resource fwd2 as "foreward2.bmp$resource power1 as "power1.bmp$resource power2 as "power2.bmpdeclare sub quit
declare sub volume
declare sub SetVolume
declare sub open
declare sub play
declare sub stop
declare sub foreward
declare sub backward
declare sub pause
Declare Sub ShowTime(Position as long,timePos as long)

const color1=&h660000
const color2=&hff9900
const color3=&h88FF66
const RazClock="00:00"
    
Dim OpenDialog as QOpenDialog
OpenDialog.Filter="Fichier vidéo(tout type)|*.avi;*.mpg;*.mpeg;*.mov|Fichier avi|*.avi|Fichier MPEG|*.mpg;*.mpeg|Fichier MOV|*.mov|"
OpenDialog.Caption= "Selectionner une vidéo"

CREATE Form AS QSkin 
  Center 
  skin.bmpHandle=img 'affectation du bitmap d'habillage  
  skin.top=-1 ' offset de position du bitmap  
  skin.left=-1 ' offset de position du bitmap 
  caption="Player"
  OffsWidth=-5
  create display as qpanel
    top=20 
    left=16
    width=311
    height=72
    bevelinner=0
    bevelouter=0 
    color=&h994400
    create bar as qpanel
      top=50 
      left=0
      width=display.width
      height=2
      bevelinner=0
      bevelouter=0 
      color=color1
    end create
    create FlashPlay as QFlashlabel
      DarkColor=color1
      LightColor=color3
      left=5
      top=2
      caption="Play"
    end create
    create FlashStop as QFlashlabel
      DarkColor=color1
      LightColor=color3
      left=5
      top=16
      caption="Stop"
      state=true
    end create
    create FlashPause as QFlashlabel
      DarkColor=color1
      LightColor=color3
      left=5
      top=30
      caption="Pause"
    end create
    create FlashTime as QFlashlabel
      DarkColor=color1
      LightColor=color2
      left=150
      top=6
      font.size=24
      caption=RazClock
      State=true
    end create
    create vu as QVuMeter
      top=1
      left=290
      width=10
      height=45
      DarkColor=color1
      LightColor=color2
      value=50
    end create
    create btOpen as QTextBtn
      UpColor=color1
      DownColor=color2
      left=5
      top=55
      font.bold=true
      caption="Open"
      OnClick=open
    end create
    create btVol as QTextBtn
      UpColor=color1
      DownColor=color2
      left=265
      top=55
      font.bold=true
      caption="Volume"
      OnClick=Volume
    end create
  end create 
  create btPlay as QskinBtn
    btUp.bmphandle=play1
    btDown.bmphandle=play2
    top=110 
    left=12
    mode=1
    OnClick=play
  end create 
  create btStop as QskinBtn
    btUp.bmphandle=stop1
    btDown.bmphandle=stop2
    top=110 
    left=44
    OnClick=stop
  end create 
  create btPause as QskinBtn
    btUp.bmphandle=pause1
    btDown.bmphandle=pause2
    top=110 
    left=76
    mode=1
    OnClick=pause
  end create 
  create btBack as QskinBtn
    btUp.bmphandle=back1
    btDown.bmphandle=back2
    top=110 
    left=108
    OnClick=backward
  end create 
  create btFwd as QskinBtn
    btUp.bmphandle=fwd1
    btDown.bmphandle=fwd2
    top=110 
    left=140
    OnClick=foreward
  end create 
  create btPower as QskinBtn
    btUp.bmphandle=power1
    btDown.bmphandle=power2
    top=110 
    left=300
    OnClick=quit
  end create 
END CREATE 

CREATE Form2 AS QFORM
  Caption="Volume"
  Width=60
  Height=190
  Center
  borderStyle=bsToolWindow 
  CREATE TbVol AS QTRACKBAR
    cursor=crHandPoint
    Orientation=tbVertical
    Frequency=5
    TickMarks=tmBoth
    TickStyle=tsAuto
    Left=5
    Top=5
    Max=0
    Min=-100
    Width=45
    Height=150
    position=-50
    OnChange=SetVolume
  END CREATE
END CREATE

CREATE video AS QVideo
  Parent=0
  volume=50
  OnChange=ShowTime
  timer.interval=200
  BorderStyle=bsSizeable
END CREATE

form.shapeform(img,&hffffff) ' affectation de la forme  
form.setdeskbar
Form.ShowModal 

Sub quit
  video.close
  form2.close
  application.terminate
End Sub

Sub volume
  form2.show
End Sub

Sub SetVolume
  vu.value=Abs(TbVol.position)
  video.volume=Abs(TbVol.position)
End Sub

Sub open
  If OpenDialog.Execute Then
    video.close
    if video.open(OpenDialog.FileName) then
      btPlay.down=false
      FlashPlay.state=false
      FlashStop.state=true
      btPause.Down=false
      FlashPause.flash=false
      FlashTime.caption=RazClock
      video.caption=GetFileName(OpenDialog.FileName)
    else
      showmessage video.error
    end if
  end if
End Sub

Sub play
  if video.FileOpen=false then
    btPlay.Down=false
  else
    FlashPause.flash=false
    FlashStop.state=false
    FlashPlay.state=true
    btPause.Down=false
    video.play
  end if
End Sub

Sub stop
  video.stop
  btPlay.down=false
  FlashPlay.state=false
  FlashStop.state=true
  btPause.Down=false
  FlashPause.flash=false
  FlashTime.caption=RazClock
End Sub

Function GetMinutes(seconds as long) as string
  dim min as integer
  dim sec as integer
  dim sMin as string
  dim sSec as string
  
  min=seconds/60
  sec=seconds mod 60
  if min<10 then
    sMin="0"+str$(min)
  else
    sMin=str$(min)
  end if
  if sec<10 then
    sSec="0"+str$(sec)
  else
    sSec=str$(sec)
  end if
  result=sMin+":"+sSec
End Function

Sub ShowTime(Position as long,timePos as long)
  FlashTime.caption=GetMinutes(timePos)
  If Video.State=VD_STOP then
    btPlay.down=false
    FlashPlay.state=false
    FlashStop.state=true
  end if
End Sub

Sub pause
  if video.state=VD_PLAY then
    video.pause
    btPlay.down=false
    FlashPlay.state=false
    FlashPause.flash=true
  else
  if video.FileOpen=false then btPause.Down=false
  end if
End Sub

Sub foreward
  if (video.currentFrame+1)<video.lenght then
    video.currentFrame=video.currentFrame+1
    FlashTime.caption=str$(video.currentFrame)
  end if
End Sub

Sub backward
  if video.currentFrame>0 then
    video.currentFrame=video.currentFrame-1
    FlashTime.caption=str$(video.currentFrame)
  end if
End Sub

 

 
 
 

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-09-19 14:23:50