 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Shawn Thomas Guest
|
Posted: Thu May 03, 2007 4:02 am Post subject: TImage not repainted in ActiveForm |
|
|
Hello again,
I have a TImage on an ActiveForm that we use to draw images on and
display in our ERP system (the ERP system doesn't have a very good
native image method, so we created the .ocx). When we first draw on
the TImage, it works just find, but when we try to draw on it
afterwards the image display doesn't change. We added methods in the
..ocx to Repaint and Refresh the form, but it still doesn't work.
The reason we use the Timage instead of a PaintBox is that when we
embed the .ocx in the ERP systems form, there is no paint of OnPaint
method available. When another form moves over the one with the .ocx,
that portion of the image is lost.
Is there a way of forcing the update of the Timage once it has been
changed?
Regards,
Shawn
-- |
|
| Back to top |
|
 |
David Ninnes Guest
|
Posted: Thu May 03, 2007 4:17 am Post subject: Re: TImage not repainted in ActiveForm |
|
|
Shawn Thomas wrote:
| Quote: | Hello again,
I have a TImage on an ActiveForm that we use to draw images on and
display in our ERP system (the ERP system doesn't have a very good
native image method, so we created the .ocx). When we first draw on
the TImage, it works just find, but when we try to draw on it
afterwards the image display doesn't change. We added methods in the
.ocx to Repaint and Refresh the form, but it still doesn't work.
The reason we use the Timage instead of a PaintBox is that when we
embed the .ocx in the ERP systems form, there is no paint of OnPaint
method available. When another form moves over the one with the .ocx,
that portion of the image is lost.
Is there a way of forcing the update of the Timage once it has been
changed?
Regards,
Shawn
image.invalidate? |
This will fire a WM_PAINT message. In your image component the paint
method will be called, in there do your paint routines. Never tried this
in an ocx though, so you may hit other problems.
hth,
Dave |
|
| Back to top |
|
 |
JD Guest
|
Posted: Thu May 03, 2007 4:34 am Post subject: Re: TImage not repainted in ActiveForm |
|
|
"Shawn Thomas" <SThomas677 (AT) swbell (DOT) net> wrote:
| Quote: |
[...] The reason we use the Timage
|
I suspect that your problem is that TImage is not TWinControl
and there's a problem generated by the ocx because of it.
| Quote: | instead of a PaintBox is that when we embed the .ocx in the
ERP systems form, there is no paint of OnPaint method
available.
|
TPaintBox has it's own OnPaint event. If you load the image
into a TBitmap, all you need is a call to TCanvas.CopyRect
from this event.
You could also derive from TPanel (a TWinControl) and override
it's Paint method where you would call CopyRect.
~ JD |
|
| Back to top |
|
 |
GrandmasterB Guest
|
Posted: Thu May 03, 2007 10:39 pm Post subject: Re: TImage not repainted in ActiveForm |
|
|
"Shawn Thomas" <SThomas677 (AT) swbell (DOT) net> wrote in message
news:4639187e (AT) newsgroups (DOT) borland.com...
| Quote: | Is there a way of forcing the update of the Timage once it has been
changed?
|
This should do it:
image.Refresh; |
|
| Back to top |
|
 |
Shawn Thomas Guest
|
Posted: Mon May 07, 2007 11:18 pm Post subject: Re: TImage not repainted in ActiveForm |
|
|
David Ninnes wrote:
| Quote: | Shawn Thomas wrote:
Hello again,
I have a TImage on an ActiveForm that we use to draw images on and
display in our ERP system (the ERP system doesn't have a very good
native image method, so we created the .ocx). When we first draw on
the TImage, it works just find, but when we try to draw on it
afterwards the image display doesn't change. We added methods in
the .ocx to Repaint and Refresh the form, but it still doesn't work.
The reason we use the Timage instead of a PaintBox is that when we
embed the .ocx in the ERP systems form, there is no paint of OnPaint
method available. When another form moves over the one with the
.ocx, that portion of the image is lost.
Is there a way of forcing the update of the Timage once it has been
changed?
Regards,
Shawn
image.invalidate?
This will fire a WM_PAINT message. In your image component the paint
method will be called, in there do your paint routines. Never tried
this in an ocx though, so you may hit other problems.
hth,
Dave
|
Dave,
I worked with this over the weekend, and still no closer. I created
an ocx with an invisible TImage and a visible Paintbox in order to try
and copy the image on the Paintbox.OnPaint event. Unfortunately, it is
still not working. Thanks for your help.
Shawn
-- |
|
| Back to top |
|
 |
Shawn Thomas Guest
|
Posted: Mon May 07, 2007 11:25 pm Post subject: Re: TImage not repainted in ActiveForm |
|
|
JD wrote:
| Quote: |
"Shawn Thomas" <SThomas677 (AT) swbell (DOT) net> wrote:
[...] The reason we use the Timage
I suspect that your problem is that TImage is not TWinControl
and there's a problem generated by the ocx because of it.
instead of a PaintBox is that when we embed the .ocx in the
ERP systems form, there is no paint of OnPaint method
available.
TPaintBox has it's own OnPaint event. If you load the image
into a TBitmap, all you need is a call to TCanvas.CopyRect
from this event.
You could also derive from TPanel (a TWinControl) and override
it's Paint method where you would call CopyRect.
~ JD
|
Jd,
I re-created the active form with an invisible TImage and a visible
PaintBox. I pass the handle of the TImage.Canvas to the ERP
application for use to draw on and on the OnPaint event of the
Paintbox, I do a copyrec between the Timage.Canvas and the PaintBox
canvas. My problem now seems to be that the TImage isn't being
updated. The first drawing on the TImage works fine but subsequent
updates don't change the image. I am still experimenting and trying to
see if I can figure out why. Thanks for your help.
Shawn
-- |
|
| Back to top |
|
 |
Shawn Thomas Guest
|
Posted: Mon May 07, 2007 11:27 pm Post subject: Re: TImage not repainted in ActiveForm |
|
|
GrandmasterB wrote:
| Quote: | "Shawn Thomas" <SThomas677 (AT) swbell (DOT) net> wrote in message
news:4639187e (AT) newsgroups (DOT) borland.com...
Is there a way of forcing the update of the Timage once it has been
changed?
This should do it:
image.Refresh;
|
GMB,
Unfortunately, the image doesn't refresh when calling this. There may
be some problems with working with an Ocx and graphics controls, but I
haven't found anything that tells me why. Thanks for your help.
Shanw
-- |
|
| Back to top |
|
 |
David Ninnes Guest
|
Posted: Tue May 08, 2007 5:59 am Post subject: Re: TImage not repainted in ActiveForm |
|
|
Shawn Thomas wrote:
| Quote: | David Ninnes wrote:
Shawn Thomas wrote:
Dave,
I worked with this over the weekend, and still no closer. I created
an ocx with an invisible TImage and a visible Paintbox in order to try
and copy the image on the Paintbox.OnPaint event. Unfortunately, it is
still not working. Thanks for your help.
Shawn
|
Hi Shawn, maybe some somple code would help at this point, or better -
try the activex group, it's been a long time since I've done any activex
stuff.
Dave |
|
| Back to top |
|
 |
JD Guest
|
Posted: Wed May 09, 2007 1:23 am Post subject: Re: TImage not repainted in ActiveForm |
|
|
"Shawn Thomas" <SThomas677 (AT) swbell (DOT) net> wrote:
Please trim your posts.
| Quote: | [...] My problem now seems to be that the TImage isn't being
updated. The first drawing on the TImage works fine but
subsequent updates don't change the image.
|
I wouldn't using an invisible TImage because if it's not
Visible, no messages will be generated to cause a repaint.
With what you have right now, after you draw on the TImage,
you then need to cause a repaint which can be accomplished
by Invalidate(ing) the TPaintBox. However, I would suggest
that you use a TBitmap instead of a TImage with the above.
Just allocates it in OnCreate and destroy it in OnDestroy.
| Quote: | I am still experimenting and trying to see if I can figure
out why.
|
Setup a simple test without the ocx. If you can't get that
working, then post your code here.
~ JD |
|
| Back to top |
|
 |
JD Guest
|
Posted: Wed May 09, 2007 1:23 am Post subject: Re: TImage not repainted in ActiveForm |
|
|
David Ninnes <david_ninnes (AT) hotmail (DOT) com> wrote:
| Quote: |
[...] maybe some somple code would help at this point,
|
Agreed.
| Quote: | or better - try the activex group,
|
Not agreed.
Shawn has not been very clear about what his actual problem
is but if you read his last reply to me, you'll see that the
TImage is indeed getting painted. It's his additional drawing
on the TImage that's not showing up.
~ JD |
|
| Back to top |
|
 |
Shawn Thomas Guest
|
Posted: Wed May 09, 2007 11:43 pm Post subject: Re: TImage not repainted in ActiveForm |
|
|
JD wrote:
| Quote: |
David Ninnes <david_ninnes (AT) hotmail (DOT) com> wrote:
[...] maybe some somple code would help at this point,
Agreed.
or better - try the activex group,
Not agreed.
Shawn has not been very clear about what his actual problem
is but if you read his last reply to me, you'll see that the
TImage is indeed getting painted. It's his additional drawing
on the TImage that's not showing up.
~ JD
|
JD & David,
Thanks again for your replies. I am out of the country until Sat.
and will pick back up with it on Monday. Have a great week/weekend.
Regards,
Shawn
-- |
|
| Back to top |
|
 |
|
|
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
|
|