Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8419375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:35:33+00:00 2026-06-10T02:35:33+00:00

Ok, after working with TShape, I need to clean my Shape1 from Lines and

  • 0

Ok, after working with TShape, I need to clean my “Shape1” from Lines and Text.

And also how to copy everything in “Shape1” into “Shape2” ?

Thanks B4 ^o^

    type
      TShape = class(ExtCtrls.TShape); //interposer class

      TForm1 = class(TForm)
        Shape1: TShape;
        Shape2: TShape;
        Button1: TButton;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
      public
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button1Click(Sender: TObject);
    begin
//        Draw some text on Shape1 := TShape 
        Shape1.Canvas.Font.Name :='Arial';// set the font 
        Shape1.Canvas.Font.Size  :=20;//set the size of the font
        Shape1.Canvas.Font.Color:=clBlue;//set the color of the text
        Shape1.Canvas.TextOut(10,10,'1999');
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
//        Copy everything from Shape1 to Shape2 (make a duplication)
//        How to do it ? 
        showmessage('copy Shape1 into Shape2');    
    end;

    End.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:35:34+00:00Added an answer on June 10, 2026 at 2:35 am

    Following pseudo-code makes a copy of SourceShape canvas content to the TargetShape canvas, but only until the TargetShape is refreshed:

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TargetShape.Canvas.CopyRect(Rect(0, 0, TargetShape.ClientWidth,
        TargetShape.ClientHeight), SourceShape.Canvas, Rect(0, 0,
        SourceShape.ClientWidth, SourceShape.ClientHeight));
    end;
    

    To clear the previously copied content, you can use the following:

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      TargetShape.Invalidate;
    end;
    

    To keep your drawing persistent you need to implement your own OnPaint event, in which whenever it fires, copy the current canvas content from the source to target using the CopyRect method like shown above.

    But the question is then, why to use a TShape control at all. It would be better to use TPaintBox and draw your stuff by yourself including the shapes that are drawn by TShape control.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am back into c/Linux. The question might look stupid, but relevant after working
I'm new into XML Serialization using .NET and after working with it for some
After working on some test code for open ID authentication, I had a break
After working in Eclipse for the past 3 years and memorizing all of the
After working with ASP.Net MVC, it has me thinking about Rails. I worked with
After working with the .NET GDI+ Rectangle object, I've noticed that if I create
I can't believe I'm back to this after working with WPF for 3 months
Drag is not working after dropping on the area. I have used Jquery UI
I wrote a simple test program for opencv to see if it's working after
I can't figure out why the next page/previous page buttons stop working after a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.