rt,望高手指点下。

解决方案 »

  1.   

    procedure TForm1.StatusBar1DblClick(Sender: TObject);
    var
        i, nLeftOffset: integer;
        r: TRect;
        pt: TPoint;
    begin
        nLeftOffset := 0;
        pt := StatusBar1.ScreenToClient(Mouse.CursorPos);    with StatusBar1 do
        begin
            for i := 0 to Panels.Count - 1 do
            begin
                r.Left := nLeftOffset;
                r.Top := 0;
                r.Bottom := Height;
                if i < Panels.Count - 1 then
                    r.Right := r.Left + Panels.Items[i].Width
                else
                    r.Right := Width;            nLeftOffset := nLeftOffset + Panels.Items[i].Width;            if PtInRect(r, pt) then
                begin
                    ShowMessage(Format('鼠标在第%d个Panel双击了', [i + 1]));
                    Exit;
                end;
            end;
        end;
    end;