fb:porticula NoPaste
ProgressBar.bi
Uploader: | OneCypher |
Datum/Zeit: | 20.09.2009 17:10:35 |
Hinweis: Dieser Quelltext ist Bestandteil des Projekts GuiPtr, zu dem es auf FreeBASIC-Portal.de eine Projektseite gibt.
Warnung: Es steht bereits eine neuere Version des Quelltexts zur Verfügung. Die hier vorliegende alte Version könnte Fehler enthalten, die in der neuen Version vielleicht ausgebessert wurden.
type ProgressBar
Object as GuiObject ptr
BackColor as uinteger = RGB(192,188,180)
ForeColor as uinteger = RGB(0,0,255)
MinValue as double = 0
MaxValue as double = 100
Value as double = 0
declare constructor(left as integer, top as integer, width as integer, height as integer)
end type
sub DrawProgressBar(GO as any ptr)
dim PG as ProgressBar ptr = GO
dim p as double
with *PG->Object
p = PG->Value / (PG->MaxValue - PG->MinValue)
if p > 1 then p = 1
line .buffer, (.left,.top)-(.left + .width, .top + .height), PG->BackColor,BF
line .buffer, (.left,.top)-(.left + (.width*p) , .top + .height), PG->ForeColor,BF
line .buffer, (.left,.top)-(.left + .width, .top + .height), RGB(0,0,0),B
end with
end sub
constructor ProgressBar(left as integer, top as integer, w as integer, h as integer)
'Objectconstruction
Object = new GuiObject(@This)
with *Object
.ClassName = "ProgressBar"
.left = left
.top = top
.width = w
.height = h
.PrivateEvents = new Events
with *.PrivateEvents
.OnDraw = @DrawProgressBar
end with
end with
end constructor