Re: Increasing size of TBitmap



Bram Bos wrote:
I have a TBitmap on my form (both autosize and stretch are false).

TBitmap has neither an AutoSize nor a Stretch property. You need to be precise about what you're talking about. You have a TImage on your form, not a TBitmap.


Its width and height are 100 pixels. I also use its canvas to draw on. Now I want to dynamically increase the width and height (e.g. when resizing my form) but no can do. The drawable area of the canvas remains 100x100..

That's because then you draw on a TImage's canvas, you actually force the control to create a TBitmap, and then you draw on the TBitmap's canvas. When the TBitmap's canvas changes, it notifies the TImage, which updates its display on the form.


When you resize the TImage, though, you do not resize the TBitmap, so although the TImage's canvas represents a larger area, the TBitmap's canvas hasn't changed. All the TImage really does is copy the contents of the TBitmap onto the screen.

I don't recommend drawing directly to a TImage. Create a TBitmap, draw on it, and then assign the bitmap to the TImage's Picture property.

--
Rob
.



Relevant Pages

  • Re: Bitmap to Icon
    ... Fuer die ImageList brauchst du ein TBitmap. ... aus dem TImage ein TBitmap zu machen. ... Um ein TBitmap zu erstellen, das du in die ImageListe packst, musst du ...
    (de.comp.lang.delphi.misc)
  • TImage vs TBitmap Verwirrung
    ... Auf der Hauptform habe ich eine TImage Komponente liegen. ... eine Klasse gebaut, welche als Übergabe-Parameter ein TBitmap ... erwartet ja ein Bitmap -- ?! ...
    (de.comp.lang.delphi.misc)
  • Re: Draw graph in TImage in Borland C++ 5
    ... A TImage holds and displays a TPicture object - which holds a TGraphic: ... then you get a default TBitmap to draw on. ... for the canvas of the TImage it gives you the TBitmap's canvas. ...
    (comp.programming)
  • Re: Increasing size of TBitmap
    ... >> I have a TBitmap on my form (both autosize and stretch are false). ... > TBitmap has neither an AutoSize nor a Stretch property. ... > I don't recommend drawing directly to a TImage. ...
    (alt.comp.lang.borland-delphi)
  • Re: To clip or not to clip
    ... ClipRect der Canvas des TImage ab. ... Deren Canvas ist aber im Unterschied ... Wer Komponenten ohne Quelltext oder richtig miese Komponenten ...
    (de.comp.lang.delphi.misc)