Buchempfehlung
Windows System Programming
Windows System Programming
Das Kompendium liefert viele interessante Informationen zur Windows-Programmierung auf Englisch. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Label.bi

Uploader:MitgliedOneCypher
Datum/Zeit:13.10.2009 11:06:06
Hinweis: Dieser Quelltext ist Bestandteil des Projekts GuiPtr, zu dem es auf FreeBASIC-Portal.de eine Projektseite gibt.

#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)
    declare constructor overload(Descriptor as string, 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

constructor label(Descriptor as string, LabelCaption as string)
    'Objectconstruction
    Object = new GuiObject(@This, Descriptor)
    with *Object
        .ClassName = "Label"
        .width = len(LabelCaption) * 8 + 2
        .height = 14
        .PrivateEvents = new Events
        with *.PrivateEvents
            .OnDraw = @DrawLabel
        end with
    end with

    'Controlelements
    Caption = LabelCaption
end constructor