0

I'm building a VCL Forms Application in RAD Studio using C++. On the Form, I have a TImage object named Image2. I can add a picture to it like this:

Image2->Canvas->Draw(0, 0, Image1->Picture->Graphic);

Now, I want to add another picture on top of it (not replacing the present picture, but adding to it). How do I do this?

Also, is there a way to do this and be able to use the mouse to move around and add the second picture wherever I want it?

The main thing - I want to add the new picture to the existing, not simply replace it.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
relayman357
  • 793
  • 1
  • 6
  • 30
  • You are already doing what you are asking for - drawing a new graphic on top of an existing graphic - so what are you really having trouble with? Just handling the mouse? Use the `TImage::OnMouse...` events, using `OnMouse(Down|Up)` to know when to draw, and using `OnMouseMove` to call `TMouse::CursorPos` and `TImage::ScreenToClient()` to determine where to draw. Though, you might consider using a `TPaintBox` instead of a `TImage`, and then draw your graphics in its `OnPaint` event. Or simply place multiple `TImage` objects on a `TScrollBox` or other container and then move them around – Remy Lebeau Mar 10 '18 at 05:11
  • by adding it you mean combine both images like alpha blending or xoring or adding? or just draw some image over another image which have not 100% overlap/coverage because of different resolution or position ? Where is the problem? Hope You know `Draw` will not resize your image if that is what you want you can try `Image2->Assign (Image1);` or use `SetSize` or `SetBounds` or `Width,Height` or whichever properties and methods your Image has. – Spektre Mar 10 '18 at 06:50

0 Answers0