Beispiele
Übersicht
Beispiele 1
Beispiele 3
Beispiele 4
Beispiele 5
Beispiele 6
Beispiele 7
Erweiterungen
 

ImageGadget


Statt über EventPaint bei Veränderungen neu zeichnen zu müssen, benutze ich hier (auch bei den nachfolgenden Programmen) ein Image.
#Include Once "window9.bi" Var hwnd=OpenWindow("Nr. 5a",100,100,270,290) CenterWindow(hwnd) ImageGadget(11,0,0,256,256) Var hbitmap=Create_Image(256,256) ImageStartDraw(hbitmap) Dim As Integer ix, iy For ix = 0 To 255 For iy = 0 To 255 PixDraw(ix+1, iy+1, BGR(120, ix, iy)) Next Next StopDraw SetImageGadget(11,hbitmap) Do Loop Until WaitEvent= EventClose

Draw


#Include Once "window9.bi" Var hwnd=OpenWindow("Nr. 5b",100,100,300,300) CenterWindow(hwnd) ImageGadget(11,0,0,300,300) Var hbitmap=Create_Image(300,300) ImageStartDraw(hbitmap) 'BoxDraw (links oben x, y, Breite, Hoehe, RahmenFarbe, 'Fuellfarbe, Pen, Style, Alpha) BoxDraw(20,20,100,100,BGR(255,0,0),BGR(0,0,200)) 'RoundBoxDraw (links oben x, y, Breite, Hoehe, RahmenFarbe, 'Fuellfarbe, Pen, Style, Abrunden x,y, Alpha) RoundBoxDraw(120,120,100,100,BGR(255,0,0),BGR(0,200,0),,,30,30) 'RoundBoxDraw RoundDraw(120,20,100,100,BGR(0,0,255),BGR(200,0,0),5) 'CircleDraw (Mittelpunkt x, y, Radius, RahmenFarbe, 'Fuellfarbe, Pen, Style, Alpha) CircleDraw(70,170,50,BGR(0,255,255),BGR(200,200,0),10) StopDraw SetImageGadget(11,hbitmap) Do Loop Until WaitEvent= EventClose

Linien


#Include Once "window9.bi" Var hwnd=OpenWindow("Nr. 5c",100,100,300,300) CenterWindow(hwnd) ImageGadget(11,0,0,300,300) Var hbitmap=Create_Image(300,300) ImageStartDraw(hbitmap) Dim As UInteger f=BGR(230,230,255) 'TextDraw(Startpunkt x, y,Text As string, Hintergrundfarbe,Textfarbe, Alpha) TextDraw(10,10,"PS_SOLID",f,BGR(255,0,0)) 'LineDraw (Startpunkt x, y, Endpunkt x, y,Strichstärke,Farbe,Style) LineDraw(100,20,260,20,2,BGR(255,0,0)) TextDraw(10,40,"PS_DASH",f,BGR(0,255,0)) 'Die Stricharten PS_DASH, PS_DOT, PS_DASHDOT und PS_DASHDOTDOT 'können nur mit der Strichstärke 1 benutzt werden. LineDraw(100,50,260,50,1,BGR(0,255,0),PS_DASH) LineDraw(100,51,260,51,1,BGR(0,255,0),PS_DASH) TextDraw(10,70,"PS_DOT",f,BGR(255,255,0)) LineDraw(100,80,260,80,1,BGR(255,255,0),PS_DOT) LineDraw(100,81,260,81,1,BGR(255,255,0),PS_DOT) TextDraw(10,100,"PS_DASHDOT",f,BGR(255,0,255)) LineDraw(110,110,260,110,1,BGR(255,0,255),PS_DASHDOT) LineDraw(110,111,260,111,1,BGR(255,0,255),PS_DASHDOT) TextDraw(10,130,"PS_DASHDOTDOT",f,BGR(255,127,127)) LineDraw(140,140,260,140,1,BGR(255,127,127),PS_DASHDOTDOT) LineDraw(140,141,260,141,1,BGR(255,127,127),PS_DASHDOTDOT) 'FillRectDraw(x, y, Farbe) FillRectDraw(1,1,f) StopDraw SetImageGadget(11,hbitmap) Do Loop Until WaitEvent= EventClose

GradientFillDraw


#Include Once "window9.bi" #define GRADIENT_FILL_RECT_H 0 #define GRADIENT_FILL_RECT_V 1 Var hwnd=OpenWindow("Nr. 5d",0,0,400,300) CenterWindow(hwnd) ImageGadget(11,0,0,400,300) Var hbitmap=Create_Image(400,300) ImageStartDraw(hbitmap) 'GradientFillDraw(x ,y , Breite, Hoehe, Rbegin, Gbegin, Bbegin, REnd, GEnd, BEnd, Style) GradientFillDraw (0,0,100,300,0,&Hffff,0,&Hffff,0,0,GRADIENT_FILL_RECT_H) GradientFillDraw (100,0,100,300,&Hffff,0,0,0,0,&Hffff,GRADIENT_FILL_RECT_H) GradientFillDraw (200,0,100,300,0,0,&Hffff,&Hf000,&H7000,0,GRADIENT_FILL_RECT_H) GradientFillDraw (300,0,100,300,&Hf000,&H7000,0,0,&Hffff,0,GRADIENT_FILL_RECT_H) StopDraw SetImageGadget(11,hbitmap) Do Loop Until WaitEvent= EventClose