Bit off-topic but here some code for a focus indicator for the active control on a form. For the code to work add a timer (approx 250 msec interval) to the form and add the following code to the OnTimer event. Also add
CODE
fLastActiveControl : TWinControl;
to the private section of the Form.
CODE
procedure TForm1.Timer1Timer(Sender: TObject);
var
b : TRect;
begin
if Assigned(fLastActiveControl) and (fLastActiveControl <> ActiveControl) then
begin
b := fLastActiveControl.BoundsRect;
Dec(b.Left);
Dec(b.Top);
Inc(b.Right);
Inc(b.Bottom);
Canvas.Brush.Color := Color;
Canvas.FrameRect(b);
end;
if Assigned(ActiveControl) then
begin
b := ActiveControl.BoundsRect;
Dec(b.Left, 1);
Dec(b.Top, 1);
Inc(b.Right, 1);
Inc(b.Bottom, 1);
Canvas.Brush.Color := cLRed;
Canvas.FrameRect(b);
end;
fLastActiveControl := ActiveControl;
end;
var
b : TRect;
begin
if Assigned(fLastActiveControl) and (fLastActiveControl <> ActiveControl) then
begin
b := fLastActiveControl.BoundsRect;
Dec(b.Left);
Dec(b.Top);
Inc(b.Right);
Inc(b.Bottom);
Canvas.Brush.Color := Color;
Canvas.FrameRect(b);
end;
if Assigned(ActiveControl) then
begin
b := ActiveControl.BoundsRect;
Dec(b.Left, 1);
Dec(b.Top, 1);
Inc(b.Right, 1);
Inc(b.Bottom, 1);
Canvas.Brush.Color := cLRed;
Canvas.FrameRect(b);
end;
fLastActiveControl := ActiveControl;
end;