You did not read carefully my request for additional information, so I leave it to you to adjust however you like.
Anyway, I believe your actual question is concerning the alignment of the panel with the transparent region. You probably do not consider that the region calculations with the form window includes the borders, so you have an offset to the right and downwards.
Since the regions are calculated including the borders of the form, you will need a variable ClientOffset: TPoint
to hold the values of width of the left border and the height of the top border (incl. title bar of the form).
var
ClientOffset: TPoint;
To calculate the ClientOffset
you can use the predefined ClientOrigin
and the forms Left
and Top
properties.
ClientOffset.X := Form36.ClientOrigin.X - Form36.Left; // Left border width
ClientOffset.Y := Form36.ClientOrigin.Y - Form36.Top; // Top border height (incl. title bar)
Then, either subtract ClientOffset
from the panels Left
and Top
properties, or add ClientOffset
to the HoleRegions
coordinates. The latter being more correct if you use the mouse (and presumably the forms client coordinates) to define the "hole" region