Exemple #1
0
 /// <summary>
 /// 获取点击目标Item
 /// </summary>
 /// <param name="Pt"></param>
 /// <returns></returns>
 private proMyItem GetItemAtPoint(Point Pt)
 {
     try
     {
         proMyItem Itm1 = null;
         if (items.Count != 0)
         {
             foreach (proMyItem Itm in items)
             {
                 if (Itm.Itemregion.IsVisible(Pt))
                 {
                     Itm1            = Itm;
                     Itm.MouseEnter1 = true;
                 }
                 else
                 {
                     Itm.MouseEnter1 = false;
                 }
             }
         }
         return(Itm1);
     }
     catch
     {
         return(null);
     }
 }
Exemple #2
0
        /// <summary>
        /// 重写OnMouseClick
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                proMyItem Itm = GetItemAtPoint(new Point(e.Location.X + this.Location.X, e.Location.Y + this.Location.Y));

                if (Itm != null)
                {
                    ItemClick(Itm);
                }
            }
        }