Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you want a control that can contain other controls — like <code>TPanel</code> can do — and a control that can display the contents of the window underneath it — like <code>TImage</code> can do when its <code>Transparent</code> property is set. It appears you are under the mistaken impression that if you put one control on top of another, you'll get the behavior of both combined. <em>That's</em> what's wrong.</p> <p>First thing you should do is get rid of the <code>TImage</code> control. That's just making things more complicated than they need to be. When you need to draw a brush pattern on the panel, draw it directly onto the panel.</p> <p>Next, realize that the <code>ws_ex_Transparent</code> window style controls whether <em>siblings</em> of the window are painted first. That says nothing about whether the <em>parent</em> of the window gets repainted. If the parent of your panel has the <code>ws_ClipChildren</code> style set, then it will not paint itself underneath where your panel supposedly is. It looks like it would help you if the parent of your panel control had the <code>ws_ex_Composited</code> style set, but as a component writer, you don't get control over your controls' parents.</p> <p><code>TImage</code> is able to appear transparent because it is not a windowed control. It has no window handle, so the OS rules about painting and clipping don't apply to it. From Windows' point of view, <code>TImage</code> doesn't exist at all. What we in the Delphi world perceive as the <code>TImage</code> painting itself is really the parent window deferring to a separate subroutine to paint a certain region of the parent window. Because of that, the <code>TImage</code> painting code can simply not paint over some of the parent's area.</p> <p>If I were doing this, I'd ask myself whether the control with the brush pattern really needed to be a container control. Could I instead just use an ordinary <code>TImage</code> with a repeating brush pattern drawn on it? Other controls can still go on top of it, but they won't be considered children of the pattern control.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload