AutoDefine "Off" $include "windowssdk.inc" 'DrawEdge API Demo TYPE tRECT INT left int top INT right INT bottom ENDTYPE tRECT rc 'DrawEdge inner and outer border constants CONST EDGE_BUMP=0x1|0x8 CONST EDGE_ETCHED=0x2|0x4 CONST EDGE_RAISED=0x1|0x4 CONST EDGE_SUNKEN=0x2|0x8 'DrawEdge border types CONST BF_ADJUST=0x2000 CONST BF_BOTTOM=0x8 CONST BF_BOTTOMLEFT=0x8|0x1 CONST BF_BOTTOMRIGHT=0x8|0x4 CONST BF_DIAGONAL=0x10 CONST BF_DIAGONAL_ENDBOTTOMLEFT=0x10|0x8|0x1 CONST BF_DIAGONAL_ENDBOTTOMRIGHT=0x10|0x8|0x4 CONST BF_DIAGONAL_ENDTOPLEFT=0x10|0x2|0x1 CONST BF_DIAGONAL_ENDTOPRIGHT=0x10|0x2|0x4 CONST BF_FLAT=0x4000 CONST BF_LEFT=0x1 CONST BF_MIDDLE=0x800 CONST BF_MONO=0x8000 CONST BF_RECT=0x1|0x2|0x4|0x8 CONST BF_RIGHT=0x4 CONST BF_SOFT=0x1000 CONST BF_TOP=0x2 CONST BF_TOPLEFT=0x2|0x1 CONST BF_TOPRIGHT=0x2|0x4 WINDOW main INT edge,style,fnt,ret UINT hDC STRING dedge1,dedge2 OpenWindow main,0,0,476,378,@MINBOX|@CAPTION|@SYSMENU|@NOAUTODRAW,0,"DrawEdge Demo",&Handler SETWINDOWCOLOR main,GetSysColor(15) CONTROL main,@Static,"API call - no Constants needed:",10,304,192,20,0,2 SETFONT main,"Arial",10,400,0,2 SETCONTROLCOLOR main,2,RGB(0,0,255),GetSysColor(15) CONTROL main,@Edit,"",10,324,452,20,0x50810000,1 SETFONT main,"Arial",8,400,0,1 hDC=GETHDC(main) rc.left=10 rc.top=160 rc.right=288 rc.bottom=294 CONTROL main,@GroupBox,"Border Styles",10,10,278,138,0x50000007,3 CONTROL main,@RadioButton,"Edge Bump",15,30,90,20,0x50018009,4 CONTROL main,@RadioButton,"Edge Etched",15,60,90,20,0x50018009,5 CONTROL main,@RadioButton,"Edge Raised",15,90,90,20,0x50018009,6 CONTROL main,@RadioButton,"Edge Sunken",15,120,90,20,0x50018009,7 CONTROL main,@Button,"Draw",160,74,70,20,0x50008001,40 CONTROL main,@CheckBox,"Adjust Rectangle",300,10,146,20,0x50018003,8 CONTROL main,@CheckBox,"Border at Bottom",300,26,132,20,0x50018003,9 CONTROL main,@CheckBox,"Border at Bottom and Left",300,42,154,20,0x50018003,10 CONTROL main,@CheckBox,"Border at Bottom and Right",300,58,155,20,0x50018003,11 CONTROL main,@CheckBox,"Diagonal Border",300,74,136,20,0x50018003,12 CONTROL main,@CheckBox,"Diagonal - end at Bottom Left",300,90,163,20,0x50018003,13 CONTROL main,@CheckBox,"Diagonal - end at Bottom Right",300,106,166,20,0x50018003,14 CONTROL main,@CheckBox,"Diagonal - end at Top Left",300,122,147,20,0x50018003,15 CONTROL main,@CheckBox,"Diagonal - end at Top Right",300,138,162,20,0x50018003,16 CONTROL main,@CheckBox,"Flat Border",300,154,83,20,0x50018003,17 CONTROL main,@CheckBox,"Border at Left Side",300,170,141,20,0x50018003,18 CONTROL main,@CheckBox,"Fill Rectangle Interior",300,186,143,20,0x50018003,19 CONTROL main,@CheckBox,"One-dimensional Border",300,202,142,20,0x50018003,20 CONTROL main,@CheckBox,"Draw Entire Border",300,218,134,20,0x50018003,21 CONTROL main,@CheckBox,"Border at Right Side",300,234,137,20,0x50018003,22 CONTROL main,@CheckBox,"Soft Buttons instead of Tiles",300,250,156,20,0x50018003,23 CONTROL main,@CheckBox,"Border at Top",300,266,112,20,0x50018003,24 CONTROL main,@CheckBox,"Border at Top and Left",300,282,159,20,0x50018003,25 CONTROL main,@CheckBox,"Border at Top and Right",300,298,167,20,0x50018003,26 SETSTATE main,6,1 SETSTATE main,21,1 DrawEdge(hDC,rc,0x0|EDGE_RAISED,0x0|BF_RECT) 'Draw a sample border FOR fnt=3 TO 26 SETFONT main,"Arial",8,400,0,fnt NEXT fnt SETFONT main,"Arial",8,400,0,40 SETCONTROLCOLOR main,40,RGB(0,0,255),GetSysColor(15) SETCONTROLCOLOR main,3,RGB(0,0,255),GetSysColor(15) dedge1="ret=DrawEdge(hDC,rc," WAITUNTIL IsWindowClosed(main) RELEASEHDC main,hDC END SUB Handler(),INT SELECT @MESSAGE CASE @IDCREATE CENTERWINDOW main CASE @IDPAINT CASE& @IDCONTROL SELECT @CONTROLID CASE 4 'Edge Bump edge=0x0|EDGE_BUMP CASE 5 'Edge Etched edge=0x0|EDGE_ETCHED CASE 6 'Edge Raised edge=0x0|EDGE_RAISED CASE 7 'Edge Sunken edge=0x0|EDGE_SUNKEN CASE 40 'Draw the box style=0x0 IF(GETSTATE(main,8))=1 THEN style=style|BF_ADJUST IF(GETSTATE(main,9))=1 THEN style=style|BF_BOTTOM IF(GETSTATE(main,10))=1 THEN style=style|BF_BOTTOMLEFT IF(GETSTATE(main,11))=1 THEN style=style|BF_BOTTOMRIGHT IF(GETSTATE(main,12))=1 THEN style=style|BF_DIAGONAL IF(GETSTATE(main,13))=1 THEN style=style|BF_DIAGONAL_ENDBOTTOMLEFT IF(GETSTATE(main,14))=1 THEN style=style|BF_DIAGONAL_ENDBOTTOMRIGHT IF(GETSTATE(main,15))=1 THEN style=style|BF_DIAGONAL_ENDTOPLEFT IF(GETSTATE(main,16))=1 THEN style=style|BF_DIAGONAL_ENDTOPRIGHT IF(GETSTATE(main,17))=1 THEN style=style|BF_FLAT IF(GETSTATE(main,18))=1 THEN style=style|BF_LEFT IF(GETSTATE(main,19))=1 THEN style=style|BF_MIDDLE IF(GETSTATE(main,20))=1 THEN style=style|BF_MONO IF(GETSTATE(main,21))=1 THEN style=style|BF_RECT IF(GETSTATE(main,22))=1 THEN style=style|BF_RIGHT IF(GETSTATE(main,23))=1 THEN style=style|BF_SOFT IF(GETSTATE(main,24))=1 THEN style=style|BF_TOP IF(GETSTATE(main,25))=1 THEN style=style|BF_TOPLEFT IF(GETSTATE(main,26))=1 THEN style=style|BF_TOPRIGHT DrawEdge(hDC,rc,EDGE_BUMP,BF_MIDDLE) 'DrawEdge call ret=DrawEdge(hDC,rc,edge,style) 'DrawEdge call IF ret=0 SETCONTROLTEXT main,1,"Invalid Call" ELSE dedge2=APPEND$(dedge1,"0x",LTRIM$(STR$(edge)),",0x",LTRIM$(STR$(style)),")") SETCONTROLTEXT main,1,dedge2 ENDIF ENDSELECT CASE @IDCLOSEWINDOW CLOSEWINDOW main ENDSELECT RETURN 0 EndSub