$INCLUDE <rapidq.INC>
TYPE QVU EXTENDS QCANVAS
Segments AS INTEGER
Value AS INTEGER
Limit AS INTEGER
Border AS INTEGER
BorderColorLight AS INTEGER
BorderColorDark AS INTEGER
BelowColorOff AS INTEGER
BelowColorOn AS INTEGER
AboveColorOff AS INTEGER
AboveColorOn AS INTEGER
SpaceColor AS INTEGER
CONSTRUCTOR
Segments=50
Value=25
Limit=40
BorderColorLight=cl3DLight
BorderColorDark=clBtnShadow
Border=1
BelowColorOff=RGB(0,96,0)
BelowColorOn=RGB(0,255,0)
AboveColorOff=RGB(96,0,0)
AboveColorOn=RGB(255,0,0)
SpaceColor=RGB(0,0,0)
END CONSTRUCTOR
SUB DrawComponent
DIM i AS INTEGER
DIM c AS INTEGER
DIM ys AS INTEGER
DIM ye AS INTEGER
FOR i=0 TO this.Segments
ys=this.Height-(this.Height/this.Segments*i)
ye=this.Height-(this.Height/this.Segments*(i+1))
IF this.Value>=i THEN
c=this.BelowColorOn
IF i>=this.Limit THEN c=this.AboveColorOn
this.FillRect 0,ys+1,this.Width,ye,c
ELSE
c=this.BelowColorOff
IF i>=this.Limit THEN c=this.AboveColorOff
this.FillRect 0,ys+1,this.Width,ye,c
END IF
this.Line 0,ys,this.Width,ys,this.SpaceColor
NEXT i
IF this.Border THEN
this.Line 0,0,this.Width,0,this.BorderColorDark
this.Line 0,0,0,this.Height,this.BorderColorDark
this.Line this.Width-1,0,this.Width-1,this.Height,this.BorderColorLight
this.Line 0,this.Height-1,this.Width-1,this.Height-1,this.BorderColorLight
END IF
END SUB
EVENT OnPaint
this.DrawComponent
END EVENT
END TYPE
CREATE VUTest AS QFORM
Width=50
Height=350
Center
CAPTION="VU Test Form"
CREATE VU1 AS QVU
Width=16
Height=300
Top=10
Left=5
Segments=100
Limit=70
AboveColorOn=RGB(255,255,0)
AboveColorOff=RGB(96,96,0)
END CREATE
CREATE VU2 AS QVU
Width=16
Height=300
Top=10
Left=25
Segments=100
Limit=80
END CREATE
CREATE Btn AS QBUTTON
Left=45
Top=10
Width=30
Height=25
CAPTION="<"
END CREATE
END CREATE
SUB ChangeVUs
VU1.Value=RND*100
VU2.Value=RND*100
VUTest.Repaint
END SUB
Application.Title="Rapid-Q VU Component by AKX"
Btn.OnClick=ChangeVUs
VUTest.SHOWMODAL
DOEVENTS
|