Exemple #1
0
        public bool IsHitLabel(PointF p, Cyotek.Windows.Forms.ImageBox i, bool isFringeLabel = false)
        {
            PointF offsetPoint;
            if (isFringeLabel)
            {
                SizeF size = i.CreateGraphics().MeasureString(this.label,GlobalSettings.fringeLabelsFont);
                var l = i.GetOffsetPoint(location);
                //click = i.GetOffsetPoint(p);
                offsetPoint = i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY));
                if (p.X < offsetPoint.X + size.Width
                    && p.X > offsetPoint.X - 4
                    && p.Y < offsetPoint.Y + size.Height + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3))
                    && p.Y > offsetPoint.Y + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3)))
                    return true;
                return false;
            }

            p = i.GetOffsetPoint(p);
            offsetPoint = i.GetOffsetPoint(new PointF(location.X + labelOffsetX, location.Y + labelOffsetY));
            if (p.X < offsetPoint.X + sizeString.Width
                && p.X > offsetPoint.X
                && p.Y < offsetPoint.Y + sizeString.Height + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3))
                && p.Y > offsetPoint.Y + (float)(8 * ((i.ZoomFactor - 0.7) / 0.3)))
                return true;
            return false;
        }