Which component to inherit from?
Posted on 1999-01-13
I am making a visual component that displays an image (that is to be edited). I have made a separate component that holds the image data, and the new component will retrieve the data from that.
I have used TImage, with no luck. It seems that the only way I can edit the image displayed is through the Canvas. I want to avoid the Canvas property altogether, it is too slow.
I am using GetDIBits and SetDIBits to alter the contents of the image if necessary...the problem is, what do I use it ON? Do it use them on TImage.Picture.Bitmap? What I want to do is operate on the image displayed, that's it.
I do not want to use an already existing bitmap. The image displayed in my component will be generated by itself, and will not be retrieved from any other source. It seems that using Picture.Bitmap gives the user the option of loading a custom bitmap...I do not want to do that!! It is not really important to stop that, since I will only be using the component for my own purposes, but I think I might be wrong in using Picture.Bitmap as the displayed image.
Is Image the wrong component to inherit from? If it is, what would be better (in Delphi 2). ALL I want is to make a component that can readily alter what it is displaying, AND contains he properties and methods of other visual components. If Image is the best component to use, what property would I use as the bitmap of the displayed image? Would there be any initialization necessary? (I tried Picture.Bitmap := TBitmap.Create, but this didn't work).