Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2001, 06:59 PM
Genesis Genesis is offline
Junior Member
 
Join Date: Jan 2001
Posts: 13
Default Erasing a line on mouse move, right after it was drawn.

You know how, in MS Paint, when you use the line tool, the line is drawn from the origin to the cursor position, and when you move the cursor, the line is deleted and redrawn at the new position, until the the mouseup event? I am trying to create that effect.

Any help would be great, thanx
Reply With Quote
  #2  
Old 01-20-2001, 01:23 AM
OregonGhost OregonGhost is offline
Member
 
Join Date: Jan 2001
Posts: 77
Default RE: Erasing a line on mouse move, right after it was drawn.

I think the real bitmap you are editing is hold in memory, in a TBitmap (or in a HBITMAP as Paint is written in C++).
If the mouse button is down, first the bitmap is drawn onto the canvas of the form (or the TImage or whatever you want). Then the new line is drawn, and on the next mousemove again the bitmap is drawn, then the line...
In the OnMouseUp-Event, either the Canvas or only the new line (from which you have the coordinates) is copied into the memory bitmap.
To make it faster you should only redraw the portion of the bitmap where the line is in.

Oregon Ghost
Reply With Quote
  #3  
Old 01-20-2001, 02:54 AM
Lapince Lapince is offline
Senior Member
 
Join Date: Jan 2001
Posts: 163
Default RE: Erasing a line on mouse move, right after it was drawn.

Another way : Paint your line in "not" style... To erase it, just repaint it in "not" style. That's one way used by Paint Shop Pro, and it's very quick !!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.