Пример #1
0
 public static void DrawEvents(
     LJD.Graphics g,
     ViewMetrics viewMetrics,
     IViewEvents eventsHandler)
 {
     foreach (var evt in Metrics.GetEventMetrics(g, eventsHandler, viewMetrics))
     {
         if (evt.VertLinePoints != null)
         {
             g.PushState();
             g.EnableAntialiasing(true);
             g.DrawLines(viewMetrics.UserEventPen, evt.VertLinePoints);
             g.PopState();
         }
         else
         {
             g.DrawLine(viewMetrics.UserEventPen, evt.VertLineA, evt.VertLineB);
         }
         if (evt.Icon != null)
         {
             g.DrawImage(evt.Icon, evt.IconRect);
         }
         g.FillRectangle(viewMetrics.EventRectBrush, evt.CaptionRect);
         g.DrawRectangle(viewMetrics.EventRectPen, evt.CaptionRect);
         g.DrawString(evt.Event.Caption, viewMetrics.EventCaptionFont,
                      viewMetrics.EventCaptionBrush, evt.CaptionDrawingOrigin,
                      viewMetrics.EventCaptionStringFormat);
     }
 }
Пример #2
0
 public static CursorType GetCursor(
     Point pt,
     ViewMetrics vm,
     IViewEvents eventsHandler,
     Func <LJD.Graphics> graphicsFactory
     )
 {
     foreach (var a in Metrics.GetActivitiesMetrics(vm, eventsHandler))
     {
         bool overLink = false;
         overLink = overLink || (a.BeginTriggerLinkRect.HasValue && a.BeginTriggerLinkRect.Value.Contains(pt));
         overLink = overLink || (a.EndTriggerLinkRect.HasValue && a.EndTriggerLinkRect.Value.Contains(pt));
         overLink = overLink || a.Milestones.Any(ms => ms.Bounds.HasValue && ms.Bounds.Value.Contains(pt));
         if (overLink)
         {
             return(CursorType.Hand);
         }
     }
     using (var g = graphicsFactory())
     {
         foreach (var bmk in Metrics.GetBookmarksMetrics(g, vm, eventsHandler))
         {
             if (bmk.IsOverLink(pt))
             {
                 return(CursorType.Hand);
             }
         }
         foreach (var evt in Metrics.GetEventMetrics(g, eventsHandler, vm))
         {
             if (evt.IsOverLink(pt))
             {
                 return(CursorType.Hand);
             }
         }
     }
     return(CursorType.Default);
 }