Guidance
指路人
g.yi.org
software / rapidq / Examples / QObject / Object / QVuMeter.inc

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

  
'=======================================================
' Type Objet
' Classe QVuMeter version 1.0
'=======================================================
     $IFNDEF TRUE
      $DEFINE True 1
     $ENDIF

     $IFNDEF FALSE
      $DEFINE False 0
     $ENDIF

     $IFNDEF boolean
      $DEFINE boolean INTEGER
     $ENDIF

     TYPE QVuMeter EXTENDS QCANVAS
      Max AS INTEGER
      Min AS INTEGER
      DarkColor AS LONG
      LightColor AS LONG
      Thickness AS SHORT PROPERTY SET SetThickness
      Interval AS SHORT PROPERTY SET SetInterval
      Value AS LONG PROPERTY SET SetValue

      WITH QVuMeter

  '=========================================
  ' Proprieté intervale
  '=========================================
       PROPERTY SET SetInterval(value AS SHORT)
        .Interval=INT(value)
       END PROPERTY

  '=========================================
  ' Proprieté épaisseur
  '=========================================
       PROPERTY SET SetThickness(value AS SHORT)
        .Thickness=INT(value)
       END PROPERTY

  '=========================================
  ' Proprieté valeur vu metre
  '=========================================
       PROPERTY SET SetValue(value AS LONG)
        .Value=value
        .repaint
       END PROPERTY

  '=========================================
  ' Evenement affichage vu metre
  '=========================================
       EVENT OnPaint
        DIM y AS SHORT
        DIM i AS SHORT
        DIM NbLine AS SHORT
        DIM NbLight AS SHORT
        DIM range AS SHORT
        DIM ValMeter AS INTEGER

        NbLine=INT(.height/(.thickness+.interval))
        range=.Max-.Min
        ValMeter=INT(.Value-.Min)
        NbLight=INT((NbLine/range)*ValMeter)
        y=.height
        FOR i=1 TO NbLine
         IF i>NbLight THEN
          .Fillrect(0,y,.width,y-.thickness,.DarkColor)
         ELSE
          .Fillrect(0,y,.width,y-.thickness,.LightColor)
         END IF
         y=y-(.thickness +.interval)
        NEXT i
       END EVENT

      END WITH

      CONSTRUCTOR
       DarkColor=&h0
       LightColor=&hffffff
       Min=0
       Max=100
       Thickness=2
       Interval=1
       Value=0
      END CONSTRUCTOR
     END TYPE
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2023-2-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-08-31 10:48:08