Code: Select all
XIncludeFile "MiniBGI.pbi"
UseModule MiniBGI
EnableExplicit
Global x.d,xwin=800, ywin=800
Global Event.i, Quit.i, wnum.i,MaxX.i,MaxY.i,MaxRadius.i
InitGraph(xwin, ywin, "tester", #White, #Black)
;---------setcolor( color )
; Colors:
; BLACK, BLUE, GREEN, CYAN, RED, MAGENT, BROWN, LIGHTGRAY, DARKGRAY,
; LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
setcolor(#White);
;---------Line( x1, y1, x2, y2);
Lines(20, 20, 100, 80);
setcolor(#Blue);
;---------rectangle( x1, y1, x2, y2);
rectangle(20, 100, 150, 150);
;---------setfillstyle( fill_style, color)
; Fill_styles:
; EMPTY_FILL, SOLID_FILL, LINE_FILL, LTSLASH_FILL, SLASH_FILL, BKSLASH_FILL,
; LTBKSLASH_FILL, HATCH_FILL, XHATCH_FILL, INTERLEAVE_FILL, WIDE_DOT_FILL,
; CLOSE_DOT_FILL, USER_FILL
setcolor(#Red);
setfillstyle(#SOLIDFILL, #Red);
;---------bar( x1, y1, x2, y2);
bar(20, 200, 150, 220);
setfillstyle(#SOLIDFILL, #Green);
bar(20, 230, 150, 250);
setfillstyle(#BKSLASHFILL, #Green);
bar(160, 200, 190, 250);
;---------Circle( X, Y, radius)
setcolor(#White);
Circles( 50, 310, 40);
;---------putpixel (X, Y, color)
putpixel(50, 310, #Red);
putpixel(60, 320, #White);
;---------arc( X, Y, start_angle, end_angle, radius);
; Angles in degrees 0-360.
; 0-right. Counter-clockwise (90-up, 180-left, 270-down)
arc( 140, 310, 0, 90, 40);
arc( 140, 310, 120, 160, 40);
;---------Ellipse(x, y, start_angle, end_angle, x_radius, y_radius)
Ellipses(60, 400, 0, 270, 50, 30);
;---------fillellipse(x, y, x_radius, y_radius);
setcolor(#Yellow);
setfillstyle(#SOLIDFILL, #Yellow);
fillellipse(170, 400, 50, 30, #Yellow);
setcolor(#White);
setfillstyle(#HATCHFILL, #Red);
fillellipse(250, 400, 30, 50, #White);
;---------pieslice( x, y, start_angle, end_angle, radius)
setcolor(#Red);
setfillstyle(#SOLIDFILL, #Red);
pieslice(350, 60, 0, 90, 40);
setcolor(#White);
setfillstyle(#SOLIDFILL, #Blue);
pieslice(350, 60, 90,180, 40);
setcolor(#Green);
;setfillstyle(#WIDEDOTFILL, #White);
pieslice(350, 65, 180, 270, 60);
setcolor(#White);
;---------setlinestyle(style, pattern, thickness);
; line styles:
; SOLID_LINE, DOTTED_LINE, CENTER_LINE, DASHED_LINE, USERBIT_LINE
; -- Normal: (SOLID_LINE, 0, 1);
setlinestyle(#DOTTEDLN, 0, 1);
Lines(300, 130, 500, 130) ;
setlinestyle(#SOLIDLN, 0, 3);
Lines(300, 150, 500, 150);
setlinestyle(#DASHEDLN, 0, 1);
rectangle(300, 170, 500, 200);
setlinestyle(#SOLIDLN, 0, 1); ;Back to normal
Lines(300, 220, 500, 220);
;---------settextjustify( horizontal, vertical )
; horizontal = LEFT_TEXT, CENTER_TEXT, Or RIGHT_TEXT
; vertical = BOTTOM_TEXT, TOP_TEXT
; -- Normal is (LEFT_TEXT, TOP_TEXT)
settextjustify(#LEFTTEXT,#TOPTEXT);
;---------settextstyle(font,direction,size)
; font = DEFAULT_FONT, TRIPLEX_FONT, SMALL_FONT, SANSSERIF_FONT, GOTHIC_FONT
; Or try numbers 0 thru 15?
; direction = HORIZ_DIR, VERT_DIR
setcolor(#Yellow);
;settextstyle(#TRIPLEX_FONT, #HORIZ_DIR, 2);
;---------outtextxy( x, y, "text")
outtextxy(300, 260, "Triplex, size 2");
setcolor(#White);
;settextstyle(#GOTHIC_FONT, #VERT_DIR, 2);
outtextxy(600, 20, "Gothic, Vertical, Size 2");
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
and SetLineStyle() was not working.
in SetLineStyle().
and also the default background of the bars appears.
Maybe hdc can be replaced in general by hWDC.