zoukankan      html  css  js  c++  java
  • ListBox类似组件,鼠标右键点击事件得到选中Item

    允许多选的ListBox需要加判断.可以参考被注释掉的代码.不再赘述.

     1 //OnMouseUp:
    2
    3 var
    4 APoint: TPoint;
    5 Index: Integer;
    6 begin
    7 if Button=mbRight then
    8 begin
    9 APoint.x := X;
    10 APoint.y := Y;
    11 Index := ListBox.ItemAtPos(APoint, True);
    12 {if (ListBox.SelCount <= 1) and (Index >= 0) then begin
    13 SelectedListBox(False);
    14 LMDListBox.Selected[Index] := True;
    15 end;}
    16 {if (LMDListBox.SelCount > 0) and (Index >= 0) and LMDListBox.Selected[Index] then
    17 begin
    18 ListBox.ItemIndex:=Index;}
    19 GetCursorPos(APoint);
    20 { InitPopupMenu(Index,PopupMenu);}//根据选中的Item对PopupMenu的MenuItem进行调整.可选
    21 PopupMenu.Popup(APoint.x,APoint.y);
    22 { end;}
    23 end;
    24 end;

      SelectListBox代码:

    1 var
    2 i: Integer;
    3 begin
    4 for i:= 0 to ListBox.Items.Count - 1 do begin
    5 ListBox.Selected[i] := Selected;
    6 end;
    7 end;

      

  • 相关阅读:
    Git 常用命令集合
    PHP CURL
    Helm安装Dashboard
    使用helm 部署Nginx
    Helm v3部署和使用
    K8s
    Linux
    CentOS下 Docker、Docker Compose 的安装教程(附详细步骤)
    Passwordless SSH Login
    秒杀业务的设计
  • 原文地址:https://www.cnblogs.com/solokey/p/2113330.html
Copyright © 2011-2022 走看看