Limit TimeItem change to whole days

        private void gantt1_OnTimeItem_Hoover(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
        {
            if (aGantt.MouseMoveKind == MouseMoveKind.move)
            {
                textBoxEvents.Text = "Moving a time item";
                DateTime suggestedStart=gantt1.DateScaler.PixelToTime(e.x);
                // but we do not accept the suggested start - we want it to differ in complete days...
                double totaldays=Math.Round((e.TimeItem.Start - gantt1.DateScaler.PixelToTime(e.x)).TotalDays);
                e.x = gantt1.DateScaler.TimeToPixel(e.TimeItem.Start - new TimeSpan((int)totaldays,0,0,0));
            }

Leave a Reply