Using Delphi Tokyo 10.2 with stylized themes. I am trying to highlight components in a form like EditTexts, ComboBoxes, etc. For example, if the user entered incorrect data, I would like to highlight the component.
In the past, we simply stained Red components, and the color was maintained by resizing / moving / reviewers in general. Now with the theme, we need to do a little more so that the color is displayed and saved.
I tried to disable each element of StyleElements [seFont, seClient, seBorder] to show the color. It works, but it seems kludgey, especially when there are many components that are tested. Also, just coloring the component in red may not look right with some themes.
I also tried just drawing a red rectangle around the components using WinAPI SetRop2 (..). For example, here is some kind of smart code, I tweaked it to take TWinControl and draw a red frame around it, I can also remove redbox using a similar call. It works,

... but apparently not saved. It seems that adding custom drawing methods might be redundant. Is there any better way?
Other things I reviewed:
All components sit on panels, and I considered using a secure hack to draw red rectangles on a panel canvas around components, but again there are more custom paint routines ...
I also consider dynamically drawing TShapes as needed, but that seems silly to me.
, , , Delphi, . ? SetRop2 (..), , , - . . .
, , TShapes . repaints TWinControl, , , .
, , .
procedure HiLiteMe(aControl : TWinControl; HILITE_FLAG : Boolean = TRUE; aColor : TColor = clRed);
const OFFSET = 4;
const BOX_NAME_PREFIX = 'HI_LITE_BOX_';
var
hiLiteBox : TShape;
uniqueBoxName : String;
begin
uniqueBoxName := BOX_NAME_PREFIX + aControl.Name;
HiLiteBox := aControl.FindComponent(uniqueBoxName) as TShape;
if NOT Assigned(hiLiteBox) then
begin
if NOT HILITE_FLAG then exit;
hiLiteBox := TShape.Create(aControl);
hiLiteBox.Parent := aControl.Parent;
hiLiteBox.Name := uniqueBoxName;
hiLiteBox.Pen.Color := aColor;
hiLiteBox.Pen.Width := offset-1;
hiLiteBox.Brush.Color := clWindow;
hiLiteBox.Left := aControl.Left - offset;
hiLiteBox.Width := aControl.Width + offset*2;
hiLiteBox.Top := aControl.Top - offset;
hiLiteBox.Height := aControl.Height + offset*2;
end;
hiLiteBox.Visible := HILITE_FLAG;
end;
HiLite ...
begin
HiLiteMe(checkListBox1, TRUE, clRed);
HiLiteMe(bitBtn3, TRUE, clBlue);
end;

, HiLites...
begin
HiLiteMe(checkListBox1, FALSE);
HiLiteMe(bitBtn3, FALSE);
end;