May 04, 2024, 01:22:40 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Rounded rectangle

Started by zolikom, January 06, 2010, 02:06:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zolikom

January 06, 2010, 02:06:59 AM Last Edit: January 06, 2010, 07:11:44 AM by zolikom
SUB snippets. Before Used: SETFONT statement to Windows
GLOBAL SUB ext_Rect(InW:WINDOW,Rectx:INT,Recty:INT,Rectw:INT,Rectt:INT,OPT Rectfg=0:INT,OPT Rectbg=0xffffff:INT)
IF Rectw<9 OR Rectt<9
RECT inw,Rectx,Recty,Rectw,Rectt,Rectfg,Rectbg:RETURN
ENDIF:LINE InW,Rectx+4,Recty,Rectx+Rectw-4,Recty,Rectfg:LINE InW,Rectx+4,Recty+Rectt-1,Rectx+Rectw-4,Recty+Rectt-1,Rectfg
LINE InW,Rectx,Recty+4,Rectx,Recty+Rectt-4,Rectfg:LINE InW,Rectx+Rectw-1,Recty+4,Rectx+Rectw-1,Recty+Rectt-4,Rectfg
PSET InW,Rectx+2,Recty+1,Rectfg:PSET InW,Rectx+3,Recty+1,Rectfg:PSET InW,Rectx+1,Recty+2,Rectfg:PSET InW,Rectx+1,Recty+3,Rectfg
PSET InW,Rectx+Rectw-3,Recty+1,Rectfg:PSET InW,Rectx+Rectw-4,Recty+1,Rectfg:PSET InW,Rectx+Rectw-2,Recty+2,Rectfg:PSET InW,Rectx+Rectw-2,Recty+3,Rectfg
PSET InW,Rectx+2,Recty+Rectt-2,Rectfg:PSET InW,Rectx+3,Recty+Rectt-2,Rectfg:PSET InW,Rectx+1,Recty+Rectt-3,Rectfg:PSET InW,Rectx+1,Recty+Rectt-4,Rectfg
PSET InW,Rectx+Rectw-3,Recty+Rectt-2,Rectfg:PSET InW,Rectx+Rectw-4,Recty+Rectt-2,Rectfg:PSET InW,Rectx+Rectw-2,Recty+Rectt-3,Rectfg:PSET InW,Rectx+Rectw-2,Recty+Rectt-4,Rectfg
LINE InW,Rectx+4,Recty+1,Rectx+Rectw-4,Recty+1,Rectbg:LINE InW,Rectx+4,Recty+Rectt-2,Rectx+Rectw-4,Recty+Rectt-2,Rectbg
LINE InW,Rectx+1,Recty+4,Rectx+1,Recty+Rectt-4,Rectbg:LINE InW,Rectx+Rectw-2,Recty+4,Rectx+Rectw-2,Recty+Rectt-4,Rectbg
RECT InW,Rectx+2,Recty+2,Rectw-4,Rectt-4,Rectbg,Rectbg:RETURN
ENDSUB

GLOBAL SUB ext_TextRect(InWin:WINDOW,InText:STRING,Inx:INT,Iny:INT,OPT rcolor=0xff0000:INT,OPT tcolor=0:INT,OPT bcolor=0xffffff:INT)
INT contW,contH:GETTEXTSIZE InWin,InText,contW,contH:ext_Rect(InWin,Inx,Iny,contW+5,contH+4,rcolor,bcolor)
FRONTPEN InWin,tcolor:BACKPEN InWin,bcolor:MOVE InWin,Inx+2,Iny+2:PRINT InWin,InText:RETURN
ENDSUB

WINDOW w

OPENWINDOW w,100,100,300,200,@MINBOX|@MAXBOX,0,"Rounded",&wsub
SETWINDOWCOLOR w,0xc7f2f0
SETFONT w,"Tahoma",10,400,0x00EE0000
ext_Rect(w,10,20,275,140,0xa0a080,0xf3eff0)
ext_TextRect(w," Rounded header ",30,12,0xa0a080,0x002000,0xa0a0ff)

WAITUNTIL w=0
END

SUB wsub
SELECT @MESSAGE
CASE @IDCLOSEWINDOW:CLOSEWINDOW w
ENDSELECT
ENDSUB

GLOBAL SUB ext_Rect(InW:WINDOW,Rectx:INT,Recty:INT,Rectw:INT,Rectt:INT,OPT Rectfg=0:INT,OPT Rectbg=0xffffff:INT)
IF Rectw<9 OR Rectt<9
RECT inw,Rectx,Recty,Rectw,Rectt,Rectfg,Rectbg:RETURN
ENDIF:LINE InW,Rectx+4,Recty,Rectx+Rectw-4,Recty,Rectfg:LINE InW,Rectx+4,Recty+Rectt-1,Rectx+Rectw-4,Recty+Rectt-1,Rectfg
LINE InW,Rectx,Recty+4,Rectx,Recty+Rectt-4,Rectfg:LINE InW,Rectx+Rectw-1,Recty+4,Rectx+Rectw-1,Recty+Rectt-4,Rectfg
PSET InW,Rectx+2,Recty+1,Rectfg:PSET InW,Rectx+3,Recty+1,Rectfg:PSET InW,Rectx+1,Recty+2,Rectfg:PSET InW,Rectx+1,Recty+3,Rectfg
PSET InW,Rectx+Rectw-3,Recty+1,Rectfg:PSET InW,Rectx+Rectw-4,Recty+1,Rectfg:PSET InW,Rectx+Rectw-2,Recty+2,Rectfg:PSET InW,Rectx+Rectw-2,Recty+3,Rectfg
PSET InW,Rectx+2,Recty+Rectt-2,Rectfg:PSET InW,Rectx+3,Recty+Rectt-2,Rectfg:PSET InW,Rectx+1,Recty+Rectt-3,Rectfg:PSET InW,Rectx+1,Recty+Rectt-4,Rectfg
PSET InW,Rectx+Rectw-3,Recty+Rectt-2,Rectfg:PSET InW,Rectx+Rectw-4,Recty+Rectt-2,Rectfg:PSET InW,Rectx+Rectw-2,Recty+Rectt-3,Rectfg:PSET InW,Rectx+Rectw-2,Recty+Rectt-4,Rectfg
LINE InW,Rectx+4,Recty+1,Rectx+Rectw-4,Recty+1,Rectbg:LINE InW,Rectx+4,Recty+Rectt-2,Rectx+Rectw-4,Recty+Rectt-2,Rectbg
LINE InW,Rectx+1,Recty+4,Rectx+1,Recty+Rectt-4,Rectbg:LINE InW,Rectx+Rectw-2,Recty+4,Rectx+Rectw-2,Recty+Rectt-4,Rectbg
RECT InW,Rectx+2,Recty+2,Rectw-4,Rectt-4,Rectbg,Rectbg:RETURN
ENDSUB

GLOBAL SUB ext_TextRect(InWin:WINDOW,InText:STRING,Inx:INT,Iny:INT,OPT rcolor=0xff0000:INT,OPT tcolor=0:INT,OPT bcolor=0xffffff:INT)
INT contW,contH:GETTEXTSIZE InWin,InText,contW,contH:ext_Rect(InWin,Inx,Iny,contW+5,contH+4,rcolor,bcolor)
FRONTPEN InWin,tcolor:BACKPEN InWin,bcolor:MOVE InWin,Inx+2,Iny+2:PRINT InWin,InText:RETURN
ENDSUB

Regards and Happy New Year!