[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 123456[7]8910 ]

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 17:49:34 08/07/01 Tue
Author: Michel
Subject: Re: Assigning bmp to TDibGraphic
In reply to: darrell 's message, "Assigning bmp to TDibGraphic" on 15:58:10 08/07/01 Tue

Hi Darrell,

Your are getting a typecast error because Image1.LoadFromFile is loading a TBitmap, which is not derived from TDibGraphic.

This is because TBitmap is still registered with the VCL. To ensure you use Envision graphic classes you can do this:

DibGraphic : TDibGraphic;

DibGraphic := EnDiGrph.NewDibGraphic(FileName);
Image1.Graphic := DibGraphic;
if Image1.Graphic <> nil then

This way you are sure that the Graphic property of Image1 is of a type derived from TDibGraphic.

Best regards,


>the code below works fine on PNG's, but when I try to
>convert a BMP, I get an "Invalid Typecast Error" when
>I try to assign the bmp it as a TDibGraphic. What am
>I doing wrong?
> image1 : Timage
> transform : TResizeTransform;
> graphic : TDibGraphic;
> image1 := Timage.create(nil);
> image1.LoadfromFile('c:\some.bmp')
> Graphic := image1.Picture.Graphic as TDibGraphic;
> Transform := TResizeTransform.Create;

[ Next Thread | Previous Thread | Next Message | Previous Message ]

[ Contact Forum Admin ]

Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.