Picture window: store the coordinates of the line you drew in a variable, then use:
menu @win {
dclick:{ drawline -r @win background of your window 1 %x %y %w %h }
}
Normal @window: you need to use the -l switch in the /window command, eg:
window -l300 @win
aline -l @win this is a test
menu @win {
dclick:{ dline -l @win $$1 }
}