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

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

  
Appendix A: QSkinBtn  
Documentation component by D.Glodt (c)2003 Appendix A: QSkinBtn

QSkinBtn Component

QSkinBtn is button component of skin type.


QSkinBtn Properties

Field Type R/W Défault





btUp QBITMAP R/W
Bitmap Image for up state.
btDown QBITMAP R/W
Bitmap image for down state.
btEnable QBITMAP R/W
Bitmap image for disable state.
mode SHORT R/W 0
Run mode button
Mode to 0:same to a QButton
Mode to 1:button stay a the down state after click.
Mode to 2:button change state after each click.
down BOOLEAN R/W FALSE
down state of button
Enabled BOOLEAN R/W TRUE
Parent QFORM,QPANEL,QTABCONTROL W
Left INTEGER R/W 0
Top INTEGER R/W 0

QSkinBtn Methods

Method Type Description Params





QSkinBtn Events

Event Type Occurs when... Params





OnClick Click on button 0

QSkinBtn Example
$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"
$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.bmp"

declare 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 aslong)

const color1=&h660000
const color2=&hff9900
const color3=&h88FF66
const RazClock="00:00"

Dim OpenDialog asQOpenDialog
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 ASQSkin
  Center
  skin.bmpHandle=img
  skin.top=-1
  skin.left=-1
  caption="Player"
  OffsWidth=-5
  create display asqpanel
    top=20
    left=16
    width=311
    height=72
    bevelinner=0
    bevelouter=0
    color=&h994400
    create bar asqpanel
      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 asQVuMeter
      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 asQskinBtn
    btUp.bmphandle=play1
    btDown.bmphandle=play2
    top=110
    left=12
    mode=1
    OnClick=play
  end create
  create btStop asQskinBtn
    btUp.bmphandle=stop1
    btDown.bmphandle=stop2
    top=110
    left=44
    OnClick=stop
  end create
  create btPause asQskinBtn
    btUp.bmphandle=pause1
    btDown.bmphandle=pause2
    top=110
    left=76
    mode=1
    OnClick=pause
  end create
  create btBack asQskinBtn
    btUp.bmphandle=back1
    btDown.bmphandle=back2
    top=110
    left=108
    OnClick=backward
  end create
  create btFwd asQskinBtn
    btUp.bmphandle=fwd1
    btDown.bmphandle=fwd2
    top=110
    left=140
    OnClick=foreward
  end create
  create btPower asQskinBtn
    btUp.bmphandle=power1
    btDown.bmphandle=power2
    top=110
    left=300
    OnClick=quit
  end create
END CREATE

CREATE Form2 ASQFORM
  Caption="Volume"
  Width=60
  Height=190
  Center
  borderStyle=bsToolWindow
  CREATE TbVol ASQTRACKBAR
    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 ASQVideo
  Parent=0
  volume=50
  OnChange=ShowTime
  timer.interval=200
  BorderStyle=bsSizeable
END CREATE

form.shapeform(img,&hffffff)
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 aslong) asstring
  dim min asinteger
  dim sec asinteger
  dim sMin asstring
  dim sSec asstring

  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 aslong,timePos aslong)
  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
 
 
 
 

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-4-20  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-10-10 15:56:06