Board index » delphi » Draw won't Draw

Draw won't Draw

I have the following code in a FormCreate procedure but when I run it none
of my BitMaps appear on the screen. The LoadFromResourceID method raises an
EAccessViolation error. I have used this code before with someone else's
.res file and it has worked. What am I doing wrong?

    for count := 1 to 5 do
    begin
        die[count] := TPicture.Create;
        PicName := 'BitMap'+ IntToStr(count);
        die[count].BitMap.LoadFromResourceName(HInstance, PicName);
        Form1.Canvas.Draw(56, 78 * count, die[count].Graphic);
    end;

Thanks in advance
Robyn Smith
Sydney, Australia

 

Re:Draw won't Draw


Try to use loadfromresourceID and order your bitmaps bij number.

Quote
Robyn Smith <rlsm...@ozemail.com.au> wrote in message

news:BLZI3.1689$lE.12112@ozemail.com.au...
Quote
> I have the following code in a FormCreate procedure but when I run it none
> of my BitMaps appear on the screen. The LoadFromResourceID method raises
an
> EAccessViolation error. I have used this code before with someone else's
> .res file and it has worked. What am I doing wrong?

>     for count := 1 to 5 do
>     begin
>         die[count] := TPicture.Create;
>         PicName := 'BitMap'+ IntToStr(count);
>         die[count].BitMap.LoadFromResourceName(HInstance, PicName);
>         Form1.Canvas.Draw(56, 78 * count, die[count].Graphic);
>     end;

> Thanks in advance
> Robyn Smith
> Sydney, Australia

Other Threads