Well, it's not ideal, but this might help your on your way.
Edit 1: Among the problems it has-
Some weird behaviors based on the fact that while the cursor is at 15, 15 on a tile, your click-and-drag will be at an odd offset.
Nothing prevents walls from overlapping.
No special handling for walls intersecting
Not using different image for vertical vs horizontal walls once built.
Thanks! I am going to look into this! Also i think i have som solutions for these problems. With the overlapping problem, isn't it possible to make the z order based on X & Y coordinate?