BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Drawing on BMP

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Moon2
Guest





PostPosted: Sat Nov 04, 2006 3:54 am    Post subject: Drawing on BMP Reply with quote



Hi all I would like to do the following but not sure how to do it. I want to
capture a onclick event on a bitmap that is displayed to a window. Once the
onclick event has occured I want a ghost of a line to follow the cursor
until another onclick event occurs. Okay so I get the co-ordinates where the
mouse click took place and draw a line from that to the current mouse
location (x,y). How do I go about removing the old line that was drawn and
redraw the new line.

Thanks Mike

P.S. I would like to do this so that the user can specify what distance on
the image he would like to see between two objects.
Back to top
Bruce Larrabee
Guest





PostPosted: Sat Nov 04, 2006 5:36 am    Post subject: Re: Drawing on BMP Reply with quote



Hi Moon2,

Draw the line and save the starting and ending coordinates.

When you are ready to remove the line save current pen color...

TColor current_color = Canvas->Pen->Color;

Set the pen to the background color...

Canvas->Pen->Color = Canvas->Brush->Color;

Draw a line using the coordinates you saved from the line drawn.

Set the pen back to the 'current color'...

Canvas->Pen->Color = current_color;


There are many variations on this theme but this is a method I
often use.

HTH,

Bruce Larrabee
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Nov 04, 2006 9:10 am    Post subject: Re: Drawing on BMP Reply with quote



"Moon2" <sbi (AT) telkomsa (DOT) net> wrote in message
news:454bbab0 (AT) newsgroups (DOT) borland.com...

Quote:
How do I go about removing the old line that was drawn

Set the Canvas's Pen->Mode property to either pmNot or pmXor. Keep track of
the coordinates of the line. When the line is drawn, the pixel valuess of
the Canvas background where the drawing occurs will be modified in such a
way that drawing over the same coordinates again with the same Mode will
restore the original pixel values. Then you can draw your new line and
store its new coordinates for later use.


Gambit
Back to top
Moon2
Guest





PostPosted: Sat Nov 04, 2006 9:10 am    Post subject: Re: Drawing on BMP Reply with quote

Thanks guys I will keep you posted if i run into any problems
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.