As long as I still have access to messages in the newsgroups, I don’t know how the topic identifier relates to the topic name (that’s all I have). However, based on a search in a newsgroup, I found several places where TImage32Ex was mentioned. I assume that this component (which is not part of the main library) was somehow part of the solution.
So, while the expansion pack from which this component comes from is no longer supported, let’s dig deeper into what it did.
First, I have to say that TImage32 will always draw (copy) the contents of its buffer onto the display. This means that any graphics behind this component will still be overwritten.
The three of TImage32Ex is to get the contents of the parents and paste it into the buffer.
With adaptations, the code looks like this:
var P: TPoint; SaveIndex: Integer; begin SaveIndex := SaveDC(Buffer.Handle); try GetViewportOrgEx(Buffer.Handle, P); SetViewportOrgEx(Buffer.Handle, PX - Left, PY - Top, nil); IntersectClipRect(Buffer.Handle, 0, 0, Parent.ClientWidth, Parent.ClientHeight); Parent.Perform(WM_ERASEBKGND, Buffer.Handle, 0); Parent.Perform(WM_PAINT, Buffer.Handle, 0); finally RestoreDC(Buffer.Handle, SaveIndex); end; end;
The above code draws (WM_PAINT) the parent content into the buffer.
For example, if you want the TPaintBox32 instance called PaintBox32 to be transparent, simply add the following code to the PaintBuffer handler:
procedure TForm3.PaintBox32PaintBuffer(Sender: TObject); var P: TPoint; SaveIndex: Integer; begin SaveIndex := SaveDC(PaintBox32.Buffer.Handle); try GetViewportOrgEx(PaintBox32.Buffer.Handle, P); SetViewportOrgEx(PaintBox32.Buffer.Handle, PX - PaintBox32.Left, PY - PaintBox32.Top, nil); IntersectClipRect(PaintBox32.Buffer.Handle, 0, 0, PaintBox32.Parent.ClientWidth, PaintBox32.Parent.ClientHeight); PaintBox32.Parent.Perform(WM_ERASEBKGND, PaintBox32.Buffer.Handle, 0); PaintBox32.Parent.Perform(WM_PAINT, PaintBox32.Buffer.Handle, 0); finally RestoreDC(PaintBox32.Buffer.Handle, SaveIndex); end; end;
Note. Although this works mostly, it may not properly capture the parent controls. This is especially true for descendants of TWinControl. Although there are solutions to cover this scenario, it’s much harder to cover this in every detail (for example, the blinking cursor of the underlying TEdit instance)