示例#1
0
        public void AddItem(string mainText, string content, object info)
        {
            MaskinListBoxItem mskitm = new MaskinListBoxItem(maskinListBoxItemLineColor, maskinListBoxItemOnLineColor, MaskinListBoxItemDownColor, mainText, content, info, Width - 19);

            Items.Add(H / 30 + 1, mskitm);
            Controls.Add(mskitm);
            mskitm.Location = new Point(1, H);
            H += 30;                //新项目加入列表时的宽度
        }
示例#2
0
 private int GetIDbyItem(MaskinListBoxItem m)
 {
     foreach (var item in Items)
     {
         if (item.Value.Equals(m))
         {
             return(item.Key);
         }
     }
     return(-1);
 }
示例#3
0
 internal void ItemClked(MaskinListBoxItem msi)
 {
     if (!msi.Equals(selectedItem))
     {
         msi.Selected = true;
         if (selectedItem != null)
         {
             selectedItem.Selected = false;
         }
         selectedItem = msi;
     }
     ItemClicked?.Invoke(new itemArgs(msi.MainText, msi.Content, msi.Info, GetIDbyItem(msi)));
 }
示例#4
0
 internal void ItemDoubleClked(MaskinListBoxItem msi)
 {
     ItemDoubleClicked?.Invoke(new itemArgs(msi.MainText, msi.Content, msi.Info, GetIDbyItem(msi)));
 }