fb:porticula NoPaste
Label.bi
Uploader: | OneCypher |
Datum/Zeit: | 20.09.2009 17:17:33 |
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.
#include once "GuiPtr.bi"
type label
Object as GuiObject ptr
BackColor as uinteger = RGB(212,208,200)
BackStyle as ubyte
ForeColor as uinteger = RGB(0,0,0)
Caption as string
Style as ubyte
declare constructor(left as integer, top as integer, LabelCaption as string)
end type
sub DrawLabel(LabelPTR as any ptr)
dim L as label ptr = LabelPTR
with *l->Object
if l->BackStyle = 1 then line .buffer, (.left,.top)-(.left + .width, .top + .height), l->BackColor, BF
select case l->Style
case 0
draw string .buffer, (.left +2 ,.top),l->caption, l->ForeColor
case 1
draw string .buffer, (.left +1 ,.top),l->caption, RGB(0,0,0)
draw string .buffer, (.left +2 ,.top-1),l->caption, RGB(0,0,0)
draw string .buffer, (.left +3 ,.top),l->caption, RGB(0,0,0)
draw string .buffer, (.left +2 ,.top+1),l->caption, RGB(0,0,0)
draw string .buffer, (.left +2 ,.top),l->caption, l->BackColor
case 2
draw string .buffer, (.left +1 ,.top),l->caption, RGB(128,128,128)
draw string .buffer, (.left +2 ,.top-1),l->caption, RGB(128,128,128)
draw string .buffer, (.left +3 ,.top),l->caption, RGB(255,255,255)
draw string .buffer, (.left +2 ,.top+1),l->caption, RGB(255,255,255)
draw string .buffer, (.left +2 ,.top),l->caption, l->ForeColor
case 3
draw string .buffer, (.left +1 ,.top),l->caption, RGB(196,196,196)
draw string .buffer, (.left +2 ,.top-1),l->caption, RGB(196,196,196)
draw string .buffer, (.left +3 ,.top),l->caption, RGB(0,0,0)
draw string .buffer, (.left +2 ,.top+1),l->caption, RGB(0,0,0)
draw string .buffer, (.left +2 ,.top),l->caption, RGB(255,255,255)
case 4
draw string .buffer, (.left +2 ,.top),l->caption, l->ForeColor
line .buffer, (.left,.top+ .height)-(.left + .width, .top + .height), l->ForeColor
end select
end with
end sub
constructor label(left as integer, top as integer, LabelCaption as string)
'Objectconstruction
Object = new GuiObject(@This)
with *Object
.ClassName = "Label"
.left = left
.top = top
.width = len(LabelCaption) * 8 + 2
.height = 14
.PrivateEvents = new Events
with *.PrivateEvents
.OnDraw = @DrawLabel
end with
end with
'Controlelements
Caption = LabelCaption
end constructor