Quickly hacked together but you get the idea :-
SuperStrict Extern "win32" Function ExtCreatePen:Int(style:Int, width:Int, logbrush:Byte Ptr, stylecount:Int, stylePtr:Byte Ptr)="ExtCreatePen@20" Function ReleaseDC( hwnd:Int, hdc:Int ) Function GetCurrentObject( hdc:Int, objectType:Int ) Function MoveToEx( hdc:Int, x:Int, y:Int, point:Int ) Function LineTo( hdc:Int, x:Int, y:Int ) Function GetCursorPos( pPoint:Byte Ptr ) Function SetROP2( hdc:Int, mode:Int ) EndExtern Global win:TGadget = CreateWindow("LineTest", 0,0, 400,400 ) Global panel:TGadget = CreatePanel( 0,0,400,400, win, PANEL_ACTIVE ) SetPanelColor panel,100,0,200 SetGadgetLayout panel,1,1,1,1 Type TLogBrush Field style:Int Field colour:Int Field hatch:Int EndType Global logBrush:TLogBrush = New TLogBrush logBrush.style = 2 'BS_HATCHED logBrush.colour = $ffffffff Type TPoint Field x:Int Field y:Int EndType Global cursorpos:TPoint = New TPoint While WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_MOUSEDOWN Case EVENT_MOUSEMOVE DrawCursor() EndSelect Wend Function DrawCursor() Global oldX:Int = -1, oldY:Int = -1 Local pen:Int = ExtCreatePen( $00010000,6,Byte Ptr(logBrush),0,Byte Ptr(0)) Local hwnd:Int = QueryGadget( panel, QUERY_HWND ) Local hdc:Int = GetDC( hwnd ) SelectObject( hdc, pen ) SetROP2( hdc, 7 ) ' R2_XORPEN ' Draw over old line (clears it because it was drawn with XOR) If( oldX <> -1 ) MoveToEx( hdc, 0, oldY, 0) LineTo( hdc, ClientWidth(panel),oldY ) MoveToEx( hdc, oldX, 0, 0) LineTo( hdc, oldX, ClientHeight(panel) ) EndIf ' Draw new line GetCursorPos( Byte Ptr(cursorpos) ) oldX = cursorpos.x oldY = cursorpos.y - 50 MoveToEx( hdc, 0, oldY, 0) LineTo( hdc, ClientWidth(panel),oldY ) MoveToEx( hdc, oldX, 0, 0) LineTo( hdc, oldX, ClientHeight(panel) ) ReleaseDC( hwnd, hdc ) DeleteObject( pen ) EndFunction