> Chrissy R wrote
> <snip>
> >Separately:
> >Your example worked except that if the design size of the image is
> >small - 100x100 - then the image can be resized but the image on the
> >bits past 100 is either direction does not draw. If I set the design
> >time size to 2000x2000 and then resize the image at runtime I get to
> >draw on the total surface. This, to me, shows a strange behaviour
> >that I can not explain. I think that your example works for what I
> >want if I make the image big at design time.
>
> The problem seems to be that the underlying DIB of the TImage doesn't
> get properly resized. If you're using a TBitmap as a back buffer then
> resize that first and assign it to the Picture property of the Image.
I have been playing with it also - what I have worked out is that the TImage
size is correct but the only part that is redrawn is anything up to the size it
was first set to. If I close the MDI form and recreate it when it should have
been bigger then it draws ok. IOW - draw some stuff outside the current
area - resize the TImage to show this other stuff and you cannot see it.
Close the MDI form and re-create it and then you can see everything.
> Something like:
You may be correct - BUT - I don't understand that code. What is
fastcall? What is the "::"? What is "*" before "Sender"? What is
"->". This does not look like the Delphi code I write.
> void __fastcall TViewForm::ViewPanelResize(TObject *Sender)
> {
> framebuffer->Width = Image1->Width;
> framebuffer->Height = Image1->Height;
>
> Image1->Picture->Assign(framebuffer);
> }
>
> This forces the bitmap that the TImage's picture is stored in to be
> properly resized when the form size changes, which should fix the
> problem with not being able to draw to the whole image.
That makes sense. It appears that a TImage needs an image to be
in it.
> >Also, if I make the image more than a bit over 2000 (probably 2048 or
> >2047) then run the app it comes up with an access violation. These two
> >things make me think that there is a problem with the image component.
> >This could be because it is meant to have an image in it and not be a
> >drawing surface.
>
> Can't say I've tried to use a TImage that size. However a 2048x2048x24
> image is going to take up something like 12meg of ram, which is a
> little expensive. If you really need to support images this size I'd
> suggest trying something a little less memory hungry, even if it means
> a relatively large amount of time spent drawing.
I cannot have it slow to draw. I need fast redrawing and efficient
programming. Students will be working on this code so it has to be
simple and not at all convoluted AND it has to be fast and flicker free
in the drawing.
>
> I just had a play around with an alternative option... a form with a
> couple of TScrollBars and a TImage which I redraw in the OnChange event
> of the scrollbars and the OnResize even of the form. It takes a bit
> more coding to get it right, but you get a lot more control over what
> happens.
I was thinking of something like this too. If both those events call a
redraw procedure then I get the simple code and the easier implementation
(I think).
Another option was to place objects on a form and draw stuff in each object.
I am trying to draw a tree and each node will be one of 10 different types. The
user has to be able to select the nodes and an object would be able to handle
this. Instead of one image I could have an image inside each node and let
Windows and Delphi handle the scrolling like it does in normal forms with
normal objects. I still have to draw lines on the form but that may be easier
that trying to do all this drawing.
Is there a component that is a line? I want a line that can go on any angle and
that I can select and pickup and move.
Chrissy.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"