Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2007, 12:11 PM
polix polix is offline
Junior Member
 
Join Date: Mar 2006
Posts: 14
Default Canvas - remove the line

Dear DP Forum Users!!

Beginner user has got simple problem. I have drawn the line in canvas

Code:
Canvas.MoveTo(x,y)
 Canvas.LineTo(x,y+5)
Now in the next step of the program I have to remove this line( and draw f.ex. circle). How can I clean or remove it?

Maciej

[COLOR=red]polix[/COLOR=red]
Reply With Quote
  #2  
Old 01-18-2007, 02:37 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 4,838
Default RE: Canvas - remove the line

Try this for a form:

[DELPHI]self.Canvas.FillRect(self.Canvas.ClipRect);[/DELPHI]

Regards,
Abdulaziz Jasser
Reply With Quote
  #3  
Old 01-18-2007, 04:23 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default RE: Canvas - remove the line

Set the Canvas Pen Mode to:
Canvas.Pen.Mode := pmNot;

and draw the line exactly the same way you did before.
Only problem is that you can't use different colors.
I'll see what else I can come up with.

[delphi]
var
x, y: Integer;

procedure TForm1.Button1Click(Sender: TObject);
begin
x := 20;
y := 20;
Canvas.Pen.Mode := pmNot;
Canvas.MoveTo(x,y);
Canvas.LineTo(x,y+50);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Canvas.MoveTo(x,y);
Canvas.LineTo(x,y+50);
end;
[/delphi]

MrBaseball34
Hook'Em Horns!

2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
  #4  
Old 01-18-2007, 04:25 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default RE: Canvas - remove the line

Here's another example:

[delphi]
procedure TForm1.Button1Click(Sender: TObject);
begin
x := 20;
y := 20;
Canvas.Pen.Mode := pmNot;
Canvas.Pen.Color := clRed;
Canvas.Brush.style := bsClear;
Canvas.MoveTo(x,y);
Canvas.Ellipse(x, y, 50, 50);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Canvas.MoveTo(x,y);
Canvas.Ellipse(x, y, 50, 50);
end;
[/delphi]

MrBaseball34
Hook'Em Horns!

2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
  #5  
Old 01-18-2007, 04:27 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default RE: Canvas - remove the line

I think this is what you're looking for:

[delphi]
procedure TForm1.Button1Click(Sender: TObject);
begin
x := 20;
y := 20;
Canvas.Pen.Mode := pmNotXor;
Canvas.Pen.Color := clAqua;
Canvas.Pen.Width := 2;
Canvas.Brush.style := bsClear;
Canvas.MoveTo(x,y);
Canvas.Ellipse(x, y, 50, 50);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Canvas.Pen.Width := 2;
Canvas.MoveTo(x,y);
Canvas.Ellipse(x, y, 50, 50);
end;
[/delphi]

MrBaseball34
Hook'Em Horns!

2005 College Football National Champions
2005 College Baseball National Champions
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 06:11 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.