"Remy Lebeau (TeamB)" <
XXXX@XXXXX.COM >wrote in message
Quote
"cedric" < XXXX@XXXXX.COM >wrote in message
news:41d1b5b0$ XXXX@XXXXX.COM ...
>The errors occur (I think) in the OnResize event of a panel in which
>I want to display an image in a TImage object...
What does your actual code look like? Please produce a minimal code
sample
that reproduces the problem.
Here are a the OnPanelResize event and the OnFormShow event of my project :
//--------------------------------------------------------------------------
-
void __fastcall TForm1::FormShow(TObject *Sender)
{
OnFormDone=true;
int TheWidth=PreviewPanel->Width;
intPanel->Width=TheWidth/2;
phaPanel->Width=TheWidth/2;
pPreviewInt->Assign(PreviewImageInt);
pPreviewPha->Assign(PreviewImagePha);
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::PreviewPanelResize(TObject *Sender)
{
if (OnFormDone)
{
int TheWidth=PreviewPanel->Width;
intPanel->Width=TheWidth/2;
phaPanel->Width=TheWidth/2;
pPreviewInt->Assign(PreviewImageInt);
pPreviewPha->Assign(PreviewImagePha);
}
}
//--------------------------------------------------------------------------
-
the global Boolean variable 'OnFormDone' is set to false in the constructor
of my project (in order to avoid displaying Image before creating the panel
or TImage object).
As you see, I display two images: one image for one TImage object insert in
one panel (align properties of TImage is set to 'alClient').
The Assign fct is fct of a class I use (TPreview). This fct link the class
TPreview to the TImage object (and display a black image in the TImage
object, if no image is already displayed in the TImage object).
When the error I explained to you occurs, I can press a 'ok' button on the
error msg box, and the form is shown: only one image (so black image,
because no previous images have been displayed) is displayed, and the other
remain white (so the Assign on the other image is KO)
Quote
>I display a new rescaled image each time the size of the panel
change....
Are you resizing the image manually? If so, then have you tried letting
the
TImage resize itself automatically instead? TImage does have AutoSize and
Stretch properties.
TImage is on a Panel that I can resize with a Splitter object. I'll tried
the AutoSize to avoid the using of the class TPreview (Assign) each time the
OnPanelResize is call...
Quote
>the errors msg is something like "Eaccess Violation ..."...so for me,
>the OnResize event want to display the image, while the TImage
>object is maybe not yet created...
Sounds like maybe a bug in your own code then. IT is hard to say for sure
since you have not shown your code yet.
>But that doesn't explaine the fact that I need to compile the soft
>under XP to use it under XP and to compile the soft under W2000
>to use it under this W2000...
You do not need to do that.
I hope:-)...nb: the exe file created with W2000 is better (more portable)
than the one created by XP. I mean that Some pc with XP has a good behavior
with the exe file created with W2000, but no (!!) W2000 OS can have a good
behavior with the exe file from XP...
Cedric...thanks