Steve,
I see a bit more clearly now. thanks for the follow up. Yes, I think I
must do a refresh or repaint to get it to show up. I thought if I drew on the
canvas and then told the image to refresh, it would just repaint its canvas
from scratch and I would lose what I had added.
I have tried things at work (Windows NT) and they worked as they had at
home. That means my system must not be terribly screwed up, as I feared :-)
Now here is my current problem or the path to "transparency". I have made a
TCustomControl descendent. I overrode the Create, Destroy and Paint methods.
Here is the code:
constructor TDripBag.Create( AnOwner : TComponent );
var
Bitmap : graphics.TBitmap;
begin
inherited;
Bitmap := graphics.TBitmap.Create;
try
Bitmap.LoadFromResourceName( HInstance, 'DRIPBAG' );
ImageList := TImageList.CreateSize( Bitmap.Width,
Bitmap.Height );
ImageList.BkColor := clNone;
ImageList.BlendColor := clNone;
ImageList.DrawingStyle := dsTransparent;
ImageList.Masked := True;
ImageList.AddMasked( Bitmap, Bitmap.Canvas.Pixels[0,0] );
finally
Bitmap.Free;
end;
Hint := 'Drip Bag Object|Drip Bag Object';
SetBounds( 0, 0, ImageList.Width, ImageList.Height );
ComponentID := '';
Position := '';
Notes := '';
end;
destructor TDripBag.Destroy;
begin
if ImageList <> nil then ImageList.Free;
inherited;
end;
procedure TDripBag.Paint;
begin
ImageList.Draw( Canvas, 0, 0, 0 );
end;
When I dynamically created one of these, the tranparency seemed at first to
work. When I placed the object on the form and changed the color of the form,
the objects transparent parts showed the form color giving the transparent
effect.
Now I placed a scrollbox on the form and an image in the scrollbox. When my
object paints, it still paints the panels color in the transparent areas. I
wanted to be able to put the object over the image and see the image underneath
the object. I end up instead with a rectangular box in the form color with my
object drawn on it. I fooled around with a variety of guesses, but no joy.
Any suggestions?