其他使用例子:响应右键菜单和鼠标双击标签关闭该标签 procedure TfrmMain.TabBarMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var inx: integer; p: TPoint; begin inx := TabBar.Tabs.IndexOf(TabBar.TabAt(X,Y)); if (inx > -1) and (ssRight in Shift) then begin GetCursorPos(p); tpmTabsMenu.Popup(p.X, p.Y); end else if (inx > -1) and (Button = mbLeft) and (ssDouble in Shift) then begin TabBar.Forms[inx].Close; end else if (ssRight in Shift) then begin GetCursorPos(p); tpmTabsMenuMain.Popup(p.X, p.Y); end; end;