|
-
Aug 24th, 2000, 09:28 AM
#1
Thread Starter
New Member
Well, here comes your graphics-trouble-maker:
I got PictureBox and I have drawn a curve on it.
Now using my mouse I draw a vertical line on the curve.
The problem is that (as you may have already guessed) I have to erase the PREVIOUS vertical line before I draw the NEW vertical line so that I can have line-following-mouse effect. To delete the previous line I draw it in the background (gray) color, yes now I have deleted the line and I can draw my new line but o-oh there's bad effect that I can't prevent, since the old vertical line intersects the curve at one point and I re-draw it using the background color I also delete one point of my lovely curve and repeating this effect all the time I can see my curve disappeat slowly.
How can I have that vertical-line-drawn-over-the-static-curve-and-following-mouse-without-disturbing-the-previously-drawn-static-curve effect?
I think I'm missing some point.
Please give me a detailed example (that means telling me much more than "use that DrawMode = vbXorPen" ).
Thanks in advance...
-
Aug 24th, 2000, 09:36 AM
#2
Set the DrawMode property to 6 - Invert before you draw the line. Then when you want to erase it just draw the same line ones more. When the user has choosen where to draw the line you can set the DrawMode back to 13 - Copy pen and draw the line in whatever color you prefer.
Good luck!
-
Aug 24th, 2000, 09:46 AM
#3
Thread Starter
New Member
6 (Invert) and 13 (Copy Pen) Didn't work
Well, I tried what you did.
First I drew my curve in a picture box (black foreground color and gray background color), then as the mouse moved, first I set the DrawMode = 6 (Invert) and then drew the same line at the same coordinates after that I set the DrawMode = 13 (Copy Pen) and drew the new line...
What happened?
I got white vertical lines all over my curve... The vertical line moved but left a white trace (white vertical line) in the picture box.
I simply can't understand what I'm doing wrong.
(I didn't play with the default color values which means I simply gave the right coordinates to the Line method and no color value...).
Can you help me?
-
Aug 24th, 2000, 10:13 AM
#4
Frenzied Member
you can store the image of the picturebox before you draw the verticle line, and then just reset it when you want.
Code:
'Put code here to draw the curve in the picturebox
'This stores the image in the picturebox's memory
Set Picture1.Picture = Picture1.Image
'now draw the vertical line here
'When you want to get rid of the verticle line just use
Picture1.Cls
and your curve will still be there because the picturebox has remembered it
obviously you don't have to do this all in one subroutine, you can do the parts whenever you like, when you Set Picture1.Picture = Picture1.Image it stores the image, when you .Cls it restores whatever is stored
to get rid of the curve from the picturebox's memory use
Code:
Set Picture1.Picture = Nothing
Oh, make sure the picturebox's AutoRedraw is set to true, otherwise it won't work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|