Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [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

UDT-REDIM-Problem

Uploader:Redakteurnemored
Datum/Zeit:16.05.2010 16:16:50

' patinc.bas
const BRand = 1, BGrau = 2

type TypButton
  as integer x, y, b, h, opt
  as string text
  declare constructor(xx as integer = -1, yy as integer = -1, bb as integer = 0, hh as integer = 0, _
          oopt as integer = BRand, ttext as string = "")
  declare function in(x as integer, y as integer) as integer
  declare sub zeichnen(mark as integer = 0)
end type
constructor TypButton(xx as integer = -1, yy as integer = -1, bb as integer = 0, hh as integer = 0, _
            oopt as integer = BRand, ttext as string = "")
  this.x = xx
  this.y = yy
  this.b = bb
  this.h = hh
  this.text = ttext
  this.opt = opt
end constructor
function TypButton.in(x as integer, y as integer) as integer
  if x >= this.x and x <= this.x + this.b and y >= this.y and y <= this.y + this.h then return -1
  return 0
end function
sub TypButton.zeichnen(mark as integer = 0)
  dim as integer whoehe, zhoehe, farbe1, farbe2, farbe3
  screeninfo , whoehe
  zhoehe = whoehe \ hiword(width)
  if this.h > 0 then
    select case mark
      case 0 : farbe1 = FGC   : farbe2 = BGC   : farbe3 = FGC
      case 1 : farbe1 = FGC   : farbe2 = FGC   : farbe3 = BGC
      case 2 : farbe1 = FGC   : farbe2 = DGRAU : farbe3 = HGRAU
      case 3 : farbe1 = DGRAU : farbe2 = BGC   : farbe3 = DGRAU
    end select
    line (this.x, this.y)-step(this.b-2, this.h-2), farbe2, bf
    line (this.x, this.y)-step(this.b-1, this.h-1), farbe1, b
    if this.opt and BRand then line (this.x+1, this.y+1)-step(this.b-3, this.h-3), farbe1, b
    draw string (this.x+this.b\2 - 4*len(this.text) + 1, this.y+this.h\2 - zhoehe\2 + 1), this.text, farbe3
  else
    line (this.x, this.y)-step(this.b-1, 16), BGC, bf
    draw string (this.x+this.b\2 - 4*len(this.text) + 1, this.y + 1), this.text
  end if
end sub


' test.bas
dim shared as integer BGC = &h000000, FGC = &hffffff, HGRAU = &hbbbbbb, DGRAU = &h555555, ROT = &hff1111, MBC = &h222222
#include once "patfinder/patinc.bas"
redim as typButton test(5)
redim as typButton test(10)