Recent

Author Topic: Form image copy  (Read 20845 times)

windy

  • Full Member
  • ***
  • Posts: 186
Form image copy
« Reply #15 on: September 15, 2007, 04:37:40 am »
I have managed to get the form background working (and it does not capture what is on top of the form :) )
and I can step through all the controls on the form OK
in a LOOP., but how do you then paint those constrols onto the bitmap?
anyone got any code snippets for capturing a control (e.g button1) on a form (like copyrect type thing)
:)

just thinking out loud here
with the original code, the copyform code, at the start of this thread, I tried setting the form to be outside the screen area.....but then you end up with black for the part of the form that is outside the screen area (i.e I moved the form to the far right of the screen)
so how can you get the form to be repainted off screen and not be black?

antonio

  • Hero Member
  • *****
  • Posts: 605
Form image copy
« Reply #16 on: September 15, 2007, 03:42:37 pm »
I have a button, a label and an empty image on a form. The label is copied to the image, at proper position and size, when I press the button. On button event:
Code: [Select]

var
  startx,starty:integer;
begin
  startx := label1.left  * image1.width  div width;
  starty := label1.top * image1.height div height;
  image1.canvas.copyrect(rect( startx, starty,
         startx+ label1.width*image1.width  div width,
         starty+label1.height*image1.height div height
                             ), label1.canvas,
                                label1.clientrect);
end;


windy

  • Full Member
  • ***
  • Posts: 186
Form image copy
« Reply #17 on: September 15, 2007, 11:00:10 pm »
I have made a bit of progress.....I can now get the edge of the control drawn (i.e a line (box) of where the control is, is drawn!)
but not yet the actual surface of the contrl

antonio

  • Hero Member
  • *****
  • Posts: 605
Form image copy
« Reply #18 on: September 15, 2007, 11:52:38 pm »
This code maintains aspect ratio, change size of the image in order to become it proportional to the form.

windy

  • Full Member
  • ***
  • Posts: 186
Form image copy
« Reply #19 on: September 16, 2007, 06:03:03 am »
Hi
yup, i saw that :)
the remaining problem now is to add to the DC the controls rect region

 

TinyPortal © 2005-2018