I need to draw a FocusRect (like a rectangle selection for MouseDown/Move/Up) on a TPanel, but all window controls on that panel is always in TOP position, which makes the focusrect to lay under the window controls if the FocusRect is painted on the TPanel.Canvas.
I have tried to draw directly on the desktop DC, but doing that not only draws the focusrect over all controls, but also over all other applications like WinAmp if WinAmp is in "Always on top" mode.
When in "Delphi EditMode" for a form you can select components on that form by pressing the mouse and dragging the FocusRect over an area and then all controls in that area becomes selected. The FocusRect Delphi draws, draws over window controls like TEdit but Delphi doesn't seem to be using the desktop DC since the FocusRect is placed over window controls on the form but under other applications..
Does anyone know how Borland does this and how I can draw a rectangle on a TPanel where the lines of that rectangle is visible over window controls???
Below is some code I used for drawing a FocusRect directly on the Screen DC, I need to modify it to just draw over a TPanel DC and over any window controls that may be on the panel..
procedure DrawScreenRect(Rct : TRect);
var dc : hDc;
Handle := 0; // Windows desktop handle = 0
dc := GetDC(handle);
Look at the following page to understand my question better...