#drawing program
2 messages in this thread
Ted, I tried changing the code in a test program so that it looks like
this:
DefInt A-Z Dim x1, y1, x2, y2, drawnow
Sub Form_MouseDown (Button As Integer, Shift As Integer, x As Single, y As
Single)
drawmode = 6
drawnow = -1
currentx = x
currenty = y
x1 = x
y1 = y End Sub
Sub Form_MouseMove (Button As Integer, Shift As Integer, x As Single, y As
Single)
If drawnow Then
x2 = x
y2 = y
Line (x1, y1)-(currentx, currenty), , B
Line (x1, y1)-(x, y), , B
End If End Sub
Sub Form_MouseUp (Button As Integer, Shift As Integer, x As Single, y As
Single)
If drawnow Then
drawmode = 13
Line (x1, y1)-(x, y), , B
drawnow = false
End If End Sub
Sub Form_Load ()
autoredraw = -1 End Sub
The rubber-banding now works in the test program which draws lines on the
form itself. When I changed the code in my drawing program, the
rubber-banding still don't work without the refresh function. My drawing
program draws lines, rectangles, ellipses, etc on a picture box which is
the same size as the white area of the form. I still can't print graphics
on my printer using the printform function. I have autoredraw property set
to true. I even tried copying the graphics from the picture box to the
white area of the form but it didn't work. I could get rid of the picture
box and draw graphics on the white area of the form but there is a status
bar on the bottom which are created from small picture boxes and I need to
copy the graphics to an hidden picture box so that I can erase any mistakes
by copying the graphics from the hidden picture box. Jeffrey.e
There is 1 Reply.
Jeffrey,
Set Autoredraw to False, then your simple code will work for
rubber-banding. I discovered this when I had rubber-banding working in my
application. When I set AutoRedraw to true, I suddenly lost the ability to
rubberband.
You could set it false in the MouseDown event, then set it back to true in
the MouseUp event.
George