Board index » delphi » D3: Bitmap problems - bitmap.zip (0/1)

D3: Bitmap problems - bitmap.zip (0/1)

Hi there all,

I hope one of you can help me out here.

The attached project has 4 TImage objects and a button.
If you click on the button, The delphi Icon is fetched into a TIcon
var. The TIcon is drawn on the Canvas of the form. Next the Icon is
stored into TImage1.Picture.Icon. No problems so far but then i get
stuck.

I want to CopyRect from the canvas to TImage2.Picture.Bitmap.Canvas.
This doesn't work.

I want to Draw the Icon on TImage4.Picture.Bitmap.Canvas.
This doesn't work EITHER !!! 8.-(

TImage3 is used to shrink TImage2 to a smaller size but obviously
nothing is shown there either.

Can anyone tell me : how do I make a bitmap out of an icon ???

PLEASE PLEASE PLEASE HELP ME !!!

Thanx 1M
Greetinx

Johan Godfried
==============================================================
e-mail : jo...@jagodfried.demon.nl
for Delphi stuff : del...@jagodfried.demon.nl
homepage : http://www.jagodfried.demon.nl

 

Re:D3: Bitmap problems - bitmap.zip (0/1)


Quote
Johan Godfried wrote:

> Hi there all,

> I hope one of you can help me out here.

> The attached project has 4 TImage objects and a button.
> If you click on the button, The delphi Icon is fetched into a TIcon
> var. The TIcon is drawn on the Canvas of the form. Next the Icon is
> stored into TImage1.Picture.Icon. No problems so far but then i get
> stuck.

> I want to CopyRect from the canvas to TImage2.Picture.Bitmap.Canvas.
> This doesn't work.

> I want to Draw the Icon on TImage4.Picture.Bitmap.Canvas.
> This doesn't work EITHER !!! 8.-(

        Evidently the Image.Picture does not currently contain
a bitmap(?)

Quote
> TImage3 is used to shrink TImage2 to a smaller size but obviously
> nothing is shown there either.

> Can anyone tell me : how do I make a bitmap out of an icon ???

        Create a TBitmap and a TIcon. LoadFromFile the icon. Set
the bitmap's size to the icon's size. Draw the icon on the bitmap,s
Canvas. (If this sounds like what you're been trying to do my guess
is that you've been using a TImage and the image has not contained
a bitmap.)

--
David Ullrich

sig.txt not found

Re:D3: Bitmap problems - bitmap.zip (0/1)


On Thu, 06 Nov 1997 11:50:53 -0600, David Ullrich

Quote
<ullr...@math.okstate.edu> wrote:
>> I want to Draw the Icon on TImage4.Picture.Bitmap.Canvas.
>> This doesn't work EITHER !!! 8.-(

>    Evidently the Image.Picture does not currently contain
>a bitmap(?)

So, what's going on here : TImage not containing a bitmap ??? But no
errors when using TImage.Picture.Bitmap ??? Sorry, but I think I
missed out something over here. Can anyone please explain this to me ?

Thanx 1M

Quote
>> TImage3 is used to shrink TImage2 to a smaller size but obviously
>> nothing is shown there either.

>> Can anyone tell me : how do I make a bitmap out of an icon ???

>    Create a TBitmap and a TIcon. LoadFromFile the icon. Set
>the bitmap's size to the icon's size. Draw the icon on the bitmap,s
>Canvas. (If this sounds like what you're been trying to do my guess
>is that you've been using a TImage and the image has not contained
>a bitmap.)

Thanx for the advise. It really helped me. Now I can carry on with my
project.

Greetinx

Johan Godfried
==============================================================
e-mail : jo...@jagodfried.demon.nl
for Delphi stuff : del...@jagodfried.demon.nl
homepage : http://www.jagodfried.demon.nl

Re:D3: Bitmap problems - bitmap.zip (0/1)


Quote
Johan Godfried wrote:

> On Thu, 06 Nov 1997 11:50:53 -0600, David Ullrich
> <ullr...@math.okstate.edu> wrote:

> >> I want to Draw the Icon on TImage4.Picture.Bitmap.Canvas.
> >> This doesn't work EITHER !!! 8.-(

> >       Evidently the Image.Picture does not currently contain
> >a bitmap(?)

> So, what's going on here : TImage not containing a bitmap ??? But no
> errors when using TImage.Picture.Bitmap ??? Sorry, but I think I
> missed out something over here. Can anyone please explain this to me ?

        What do you mean, "no errors"? You said "This doesn't work EITHER
!!! 8.-(" Exactly what did "doesn't work" mean, if there were no errors?

        TPicture can contain a TBitmap or a TMetafile or a TIcon or
various other graphic classes, if they've been registered with TPicture
via RegisterFileFormat. It cannot contain more than one type simultaneously -
if it currently contains a metafile then accessing the bitmap will fail
since there is no bitmap. And I suspect that immediately after it's
been created it doesn't contain anything.

--
David Ullrich

sig.txt not found

Other Threads