public bool IsEquals(ColorLabelHitInfo hitInfo)
 {
     if (hitInfo == null)
     {
         return(false);
     }
     return(HitTest == hitInfo.HitTest && LabelIndex == hitInfo.LabelIndex);
 }
        public override bool UpdateObjectState(MouseButtons mouseButtons, Point mousePosition)
        {
            ColorLabelHitInfo hitInfo = (ColorLabelHitInfo)CalcHitInfo(mousePosition);
            bool res = !HoverInfo.IsEquals(hitInfo);

            HoverInfo = hitInfo;
            return(res);
        }
 private void OnHoverInfoChanged(ColorLabelHitInfo prevInfo, ColorLabelHitInfo hoverInfo)
 {
     if (OwnerControl != null)
     {
         OwnerControl.Invalidate();
         OwnerControl.Update();
     }
 }
        public virtual void OnMouseUp(MouseEventArgs e)
        {
            ColorLabelHitInfo info = (ColorLabelHitInfo)ViewInfo.CalcHitInfo(e.Location);

            if (ViewInfo.PressedInfo.IsEquals(info))
            {
                if (info.HitTest == EditHitTest.Button)
                {
                    Control.EditValue = info.LabelIndex > 0 ? Control.Properties.Labels[info.LabelIndex].Value : null;
                }
            }
            ViewInfo.PressedInfo = new ColorLabelHitInfo(Point.Empty);
        }
        public override EditHitInfo CalcHitInfo(Point p)
        {
            ColorLabelHitInfo hitInfo = new ColorLabelHitInfo(p);

            for (int i = 0; i < LabelItem.Labels.Count; i++)
            {
                if (LabelsBounds[i].Contains(p))
                {
                    hitInfo.SetHitTestCore(EditHitTest.Button);
                    hitInfo.SetHitObjectCore(LabelItem.Labels[i]);
                    hitInfo.LabelIndex = i;
                    break;
                }
            }
            return(hitInfo);
        }