Linux(PCLinuxOS)でパネルの背景色を繰り返し前後に変えるテストプログラムを作ったのですが、なかなかうまくいきません。何かをクリックした場合にのみパネルの背景色を更新するか、winform にマウスオーバーすると停止するか、しばらく実行した後にプログラムが完全にクラッシュします。
ボタンとタイマーの 2 つのパネルで winform がどのように見えるかを次に示します。

その背後にあるコードは次のとおりです。
namespace TestIndicator;
interface
uses
  System.Drawing,
  System.Collections,
  System.Collections.Generic,
  System.Windows.Forms,
  System.ComponentModel;
type
  /// <summary>
  /// Summary description for MainForm.
  /// </summary>
  MainForm = partial class(System.Windows.Forms.Form)
  private
    method d_Click(sender: System.Object; e: System.EventArgs);
    method timer1_Tick(sender: System.Object; e: System.EventArgs);
  protected
    method Dispose(disposing: Boolean); override;
  public
    constructor;
  end;
var
    TurnOnRx, TurnOnTx:Boolean;
implementation
{$REGION Construction and Disposition}
constructor MainForm;
begin
  //
  // Required for Windows Form Designer support
  //
  InitializeComponent();
  //
  // TODO: Add any constructor code after InitializeComponent call
  //
  TurnOnRx := true;
  TurnOnTx := true;
end;
method MainForm.Dispose(disposing: Boolean);
begin
  if disposing then begin
    if assigned(components) then
      components.Dispose();
    //
    // TODO: Add custom disposition code here
    //
  end;
  inherited Dispose(disposing);
end;
{$ENDREGION}
method MainForm.d_Click(sender: System.Object; e: System.EventArgs);
begin
    timer1.Enabled := not timer1.Enabled;  
end;
method MainForm.timer1_Tick(sender: System.Object; e: System.EventArgs);
begin
    if TurnOnTx then
    begin
        TurnOnTx:=false;
        TxLight.BackColor := Color.Red;
    end
    else
    begin
        TurnOnTx:=true;
        TxLight.BackColor := Color.black;
    end;
    if TurnOnRx then
    begin
        TurnOnRx := false;
        RxLight.BackColor := Color.Lime;
    end
    else
    begin
        TurnOnRx := true;
        RxLight.BackColor := Color.Black;
    end;
end;
end.