Re: OpenPictureDialog Problems
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 22 Jul 2005 10:01:48 +0200
<cybatech@xxxxxxxxxxxxx> wrote in message
news:6cu0e1hd0q1nkt2ldj0d62ej1dt7uo404h@xxxxxxxxxx
> Can some please tell me why this won't work?
>
> procedure TForm1.Button1Click(Sender: TObject);
> var OpenPicDlg : TOpenPictureDialog;
> Bitmap: TBitmap;
> NewShape : TManyShape;
> begin
> Bitmap := TBitmap.Create;
> OpenPicDlg := TOpenPictureDialog.Create(Self);
> if OpenPicDlg.Execute then
> begin
> bitmap.LoadFromFile(OpenPicDlg.FileName);
> Newshape.Image :=Bitmap;
> end;
> OpenPicDlg.Free;
> end;
One easy guess: no NewShape:=TManyShape.Create anywhere.
Did you step through this code and see exactly where the
error occurs? For that matter, what _is_ the error message,
and why aren't you telling us?
Does it work when you assign the loaded bitmap to a TImage
component on your form instead of to NewShape?
It's a good habit to _always_ start a try-finally after a
Create and Free in the finally clause.
Groetjes,
Maarten Wiltink
.
- Follow-Ups:
- Re: OpenPictureDialog Problems
- From: cybatech
- Re: OpenPictureDialog Problems
- References:
- OpenPictureDialog Problems
- From: cybatech
- OpenPictureDialog Problems
- Prev by Date: OpenPictureDialog Problems
- Next by Date: WTB: Delphi 7 Personal or Pro
- Previous by thread: OpenPictureDialog Problems
- Next by thread: Re: OpenPictureDialog Problems
- Index(es):