private void schedulerControl1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { SchedulerViewInfoBase viewInfo = schedulerControl1.ActiveView.ViewInfo; SchedulerHitInfo hitInfo = viewInfo.CalcHitInfo(e.Location, false); if (hitInfo.HitTest == SchedulerHitTest.AppointmentContent) { AppointmentViewInfo info = (AppointmentViewInfo)hitInfo.ViewInfo; foreach (ViewInfoItem item in info.Items) { ViewInfoImageItem imageItemInfo = item as ViewInfoImageItem; if (imageItemInfo == null) { continue; } Rectangle itemBounds = info.ConvertToVisualBounds(item.Bounds); if (itemBounds.Contains(e.Location)) { MyMessageBox mb = new MyMessageBox(((ViewInfoImageItem)item).Image, "Got it!"); mb.ShowDialog(); } } } } }
private void schedulerControl1_MouseMove(object sender, MouseEventArgs e) { SchedulerControl scheduler = sender as SchedulerControl; if (scheduler == null) { return; } Point pos = new Point(e.X, e.Y); SchedulerViewInfoBase viewInfo = schedulerControl1.ActiveView.ViewInfo; SchedulerHitInfo hitInfo = viewInfo.CalcHitInfo(pos, false); if (hitInfo.HitTest == SchedulerHitTest.AppointmentContent) { Appointment apt = ((AppointmentViewInfo)hitInfo.ViewInfo).Appointment; Text = apt.Subject; } else if (scheduler.ActiveView.Type == SchedulerViewType.Day && hitInfo.HitTest == SchedulerHitTest.Cell) { int diff = pos.Y - hitInfo.ViewInfo.Bounds.Y; long ticksPerPixel = hitInfo.ViewInfo.Interval.Duration.Ticks / hitInfo.ViewInfo.Bounds.Height; long ticksCount = ticksPerPixel * diff; DateTime actualTime = hitInfo.ViewInfo.Interval.Start.AddTicks(ticksCount); Text = actualTime.ToString(); } else if (hitInfo.HitTest == SchedulerHitTest.None) { Text = Application.ProductName; } else { Text = string.Empty; } }
private void schedulerControl1_MouseMove(object sender, MouseEventArgs e) { try { Point pos = new Point(e.X, e.Y); SchedulerViewInfoBase viewInfo = schedulerControl1.ActiveView.ViewInfo; SchedulerHitInfo hitInfo = viewInfo.CalcHitInfo(pos, false); if (hitInfo.HitTest == SchedulerHitTest.AppointmentContent) { apptSelected = ((AppointmentViewInfo)hitInfo.ViewInfo).Appointment; whatsSelected = Selection.Appointment; } else if (schedulerControl1.ActiveView.Type == SchedulerViewType.Month && hitInfo.HitTest == SchedulerHitTest.Cell) { int diff = pos.Y - ((SelectableIntervalViewInfo)hitInfo.ViewInfo).Bounds.Y; long ticksPerPixel = ((SelectableIntervalViewInfo)hitInfo.ViewInfo).Interval.Duration.Ticks / ((SelectableIntervalViewInfo)hitInfo.ViewInfo).Bounds.Height; long ticksCount = (long)ticksPerPixel * diff; dateSel = ((SelectableIntervalViewInfo)hitInfo.ViewInfo).Interval.Start.AddTicks(ticksCount); whatsSelected = Selection.Date; } else if (hitInfo.HitTest == SchedulerHitTest.None) { whatsSelected = Selection.Nothing; } else { whatsSelected = Selection.Nothing; } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }