private void HideWeekends(bool hide)
        {
            TimeScaleCollection scales = schedulerControl1.TimelineView.Scales;

            if (hide)
            {
                scales.BeginUpdate();
                try {
                    scales.Clear();
                    scales.Add(new TimeScaleMonth());
                    TimeScaleWorkWeekDay customWorkWeekScale    = new TimeScaleWorkWeekDay();
                    TimeScaleLessThanDay customTimeScaleHour    = new TimeScaleLessThanDay(TimeSpan.FromHours(1));
                    TimeScaleLessThanDay customTimeScaleMinutes = new TimeScaleLessThanDay(TimeSpan.FromMinutes(30));
                    customWorkWeekScale.Width    = 125;
                    customTimeScaleHour.Width    = 125;
                    customTimeScaleMinutes.Width = 125;
                    scales.Add(customWorkWeekScale);
                    scales.Add(customTimeScaleHour);
                    scales.Add(customTimeScaleMinutes);
                }
                finally {
                    scales.EndUpdate();
                }

                checkEdit2.Enabled = true;
            }
            else
            {
                scales.BeginUpdate();
                try {
                    scales.Clear();
                    scales.Add(new TimeScaleMonth());
                    TimeScaleDay dayScale = new TimeScaleDay();
                    scales.Add(dayScale);
                    TimeScaleHour hourScale = new TimeScaleHour();
                    hourScale.Width = 125;
                    scales.Add(hourScale);
                }
                finally {
                    scales.EndUpdate();
                }

                checkEdit2.Enabled = false;
            }
        }
        private void HideWeekends(bool hide)
        {
            var scales = schedulerControl1.TimelineView.Scales;

            try
            {
                scales.BeginUpdate();
                scales.Clear();
                scales.Add(new TimeScaleMonth());
                if (hide)
                {
                    var customWorkWeekScale    = new MyTimeScaleWorkWeekDays();
                    var customTimeScaleHour    = new MyTimeScaleWorkHours();
                    var customTimeScaleMinutes = new TimeScaleFixedInterval(TimeSpan.FromMinutes(30));

                    customWorkWeekScale.Width    = 125;
                    customTimeScaleHour.Width    = 125;
                    customTimeScaleMinutes.Width = 125;

                    scales.Add(customWorkWeekScale);
                    scales.Add(customTimeScaleHour);
                    scales.Add(customTimeScaleMinutes);
                }
                else
                {
                    scales.Add(new TimeScaleDay());
                    var hourScale = new TimeScaleHour();
                    hourScale.Width = 125;
                    scales.Add(hourScale);
                }
            }
            finally
            {
                scales.EndUpdate();
            }
        }
コード例 #3
0
        private void LoadScheduler()
        {
            if (IterationScheduler != null)
            {
                return;
            }
            IterationScheduler = new SchedulerControl();
            this.layoutControlItem1.Control     = IterationScheduler;
            this.layoutControlItem1.TextVisible = false;
            this.dataLayoutControl1.Controls.Add(IterationScheduler);

            IterationScheduler.ActiveViewType = DevExpress.XtraScheduler.SchedulerViewType.Gantt;
            IterationScheduler.GroupType      = DevExpress.XtraScheduler.SchedulerGroupType.Resource;
            IterationScheduler.Name           = "IterationScheduler";
            IterationScheduler.Start          = new System.DateTime(2012, 7, 1, 0, 0, 0, 0);
            IterationScheduler.Storage        = this.schedulerStorage1;
            IterationScheduler.ActiveView.ResourcesPerPage = 4;

            //timeRuler1
            TimeRuler timeRuler1 = new TimeRuler();

            timeRuler1.TimeZone.DaylightBias = System.TimeSpan.Parse("-01:00:00");
            timeRuler1.TimeZone.UtcOffset    = System.TimeSpan.Parse("08:00:00");
            timeRuler1.UseClientTimeZone     = false;

            //timeScaleYear1
            TimeScaleYear timeScaleYear1 = new TimeScaleYear();

            timeScaleYear1.Enabled = false;

            //timeScaleQuarter1
            TimeScaleQuarter timeScaleQuarter1 = new TimeScaleQuarter();

            timeScaleQuarter1.Enabled = false;

            //timeScaleMonth1
            TimeScaleMonth timeScaleMonth1 = new TimeScaleMonth();

            timeScaleMonth1.Visible = false;

            //timeScaleWeek1
            TimeScaleWeek timeScaleWeek1 = new TimeScaleWeek();

            timeScaleWeek1.DisplayFormat = "MMMM dd";
            timeScaleWeek1.Width         = 120;

            //timeScaleDay1
            TimeScaleDay timeScaleDay1 = new TimeScaleDay();

            timeScaleDay1.Enabled = false;
            timeScaleDay1.Visible = false;
            timeScaleDay1.Width   = 28;

            //timeScaleHour1
            TimeScaleHour timeScaleHour1 = new TimeScaleHour();

            timeScaleHour1.Enabled = false;

            // timeScaleFixedInterval1
            TimeScaleFixedInterval timeScaleFixedInterval1 = new TimeScaleFixedInterval();

            timeScaleFixedInterval1.Enabled = false;


            IterationScheduler.Views.DayView.TimeRulers.Add(timeRuler1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleYear1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleQuarter1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleMonth1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleWeek1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleDay1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleHour1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleFixedInterval1);
            this.IterationScheduler.Views.GanttView.ShowResourceHeaders = false;

            //timeScaleYear2
            TimeScaleYear timeScaleYear2 = new DevExpress.XtraScheduler.TimeScaleYear();

            timeScaleYear2.Enabled = false;

            //timeScaleQuarter2
            TimeScaleQuarter timeScaleQuarter2 = new TimeScaleQuarter();

            timeScaleQuarter2.Enabled = false;

            //timeScaleMonth2
            TimeScaleMonth timeScaleMonth2 = new TimeScaleMonth();

            timeScaleMonth2.Enabled = false;

            //timeScaleWeek2
            TimeScaleWeek timeScaleWeek2 = new TimeScaleWeek();

            timeScaleWeek2.DisplayFormat = "yyyy-MM-dd";

            //timeScaleDay2
            TimeScaleDay timeScaleDay2 = new TimeScaleDay();

            timeScaleDay2.Visible = false;
            timeScaleDay2.Width   = 20;

            //timeScaleHour2
            TimeScaleHour timeScaleHour2 = new TimeScaleHour();

            timeScaleHour2.Enabled = false;

            //timeScaleFixedInterval2
            TimeScaleFixedInterval timeScaleFixedInterval2 = new TimeScaleFixedInterval();

            timeScaleFixedInterval2.Enabled = false;

            //timeRuler2
            TimeRuler timeRuler2 = new TimeRuler();

            timeRuler2.TimeZone.DaylightBias = System.TimeSpan.Parse("-01:00:00");
            timeRuler2.TimeZone.UtcOffset    = System.TimeSpan.Parse("08:00:00");
            timeRuler2.UseClientTimeZone     = false;

            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleYear2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleQuarter2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleMonth2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleWeek2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleDay2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleHour2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleFixedInterval2);
            this.IterationScheduler.Views.WorkWeekView.TimeRulers.Add(timeRuler2);
            this.resourcesTree1.SchedulerControl = IterationScheduler;
        }
コード例 #4
0
ファイル: FrmPB_LGGTT.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 甘特图初始化设置
        /// </summary>
        /// <param name="sc"></param>
        private void InitGrantView(DevExpress.XtraScheduler.SchedulerControl sc)
        {
            //设置资源
            sc.GroupType = SchedulerGroupType.Resource;

            //设置甘特图
            sc.ActiveViewType = SchedulerViewType.Gantt;

            //设置资源+-按钮不可见

            sc.ResourceNavigator.Visibility = ResourceNavigatorVisibility.Auto;

            //设置Resource 字体不旋转
            sc.OptionsView.ResourceHeaders.RotateCaption = false;
            sc.OptionsView.ResourceHeaders.Height        = 60;
            sc.OptionsView.ShowOnlyResourceAppointments  = true;


            //行为设置

            sc.OptionsBehavior.MouseWheelScrollAction = MouseWheelScrollAction.Auto;

            sc.OptionsBehavior.RecurrentAppointmentDeleteAction = RecurrentAppointmentAction.Cancel;
            sc.OptionsBehavior.RecurrentAppointmentEditAction   = RecurrentAppointmentAction.Cancel;
            sc.OptionsBehavior.RemindersFormDefaultAction       = RemindersFormDefaultAction.DismissAll;

            //自定义动作设置

            //禁止块冲突
            sc.OptionsCustomization.AllowAppointmentConflicts = AppointmentConflictsMode.Allowed;
            //不允许复制
            sc.OptionsCustomization.AllowAppointmentCopy = UsedAppointmentType.None;
            //不允许创建
            sc.OptionsCustomization.AllowAppointmentCreate = UsedAppointmentType.None;
            //不允许删除
            sc.OptionsCustomization.AllowAppointmentDelete = UsedAppointmentType.None;
            //不允许拖到
            sc.OptionsCustomization.AllowAppointmentDrag = UsedAppointmentType.None;
            //不允许不同资源间创建
            sc.OptionsCustomization.AllowAppointmentDragBetweenResources = UsedAppointmentType.None;
            //允许编辑
            //sc.OptionsCustomization.AllowAppointmentEdit = UsedAppointmentType.All;
            //不允许多个选择
            sc.OptionsCustomization.AllowAppointmentMultiSelect = false;
            //不允许改变大小
            sc.OptionsCustomization.AllowAppointmentResize = UsedAppointmentType.None;
            //不允许依赖窗体弹出
            sc.OptionsCustomization.AllowDisplayAppointmentDependencyForm = AllowDisplayAppointmentDependencyForm.Never;
            //允许Appointment窗体弹出
            sc.OptionsCustomization.AllowDisplayAppointmentForm = AllowDisplayAppointmentForm.Never;
            //不允许编辑文字
            sc.OptionsCustomization.AllowInplaceEditor = UsedAppointmentType.None;

            //GrantView
            //sc.Views.GanttView.CellsAutoHeightOptions.Enabled = false;//设置单元格不自适应高度

            //sc.Views.GanttView.CellsAutoHeightOptions.MinHeight = 40;//设置最小高度


            //设置Appointment 的高度不自适应
            //sc.Views.GanttView.AppointmentDisplayOptions.AppointmentAutoHeight = false;
            sc.Views.GanttView.AppointmentDisplayOptions.AppointmentHeight = 40;
            //sc.Views.GanttView.AppointmentDisplayOptions.AppointmentInterspacing = 1;
            sc.Views.GanttView.AppointmentDisplayOptions.ContinueArrowDisplayType = AppointmentContinueArrowDisplayType.Never;
            //不显示开始时间
            sc.Views.GanttView.AppointmentDisplayOptions.StartTimeVisibility = AppointmentTimeVisibility.Never;
            //不显示结束时间
            sc.Views.GanttView.AppointmentDisplayOptions.EndTimeVisibility = AppointmentTimeVisibility.Never;
            //不显示进度条
            sc.Views.GanttView.AppointmentDisplayOptions.PercentCompleteDisplayType = PercentCompleteDisplayType.None;
            //不显示恢复
            sc.Views.GanttView.AppointmentDisplayOptions.ShowRecurrence = false;
            //不显示提醒
            sc.Views.GanttView.AppointmentDisplayOptions.ShowReminder    = false;
            sc.Views.GanttView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Never;
            //不显示状态
            sc.Views.GanttView.AppointmentDisplayOptions.StatusDisplayType = AppointmentStatusDisplayType.Never;
            //显示样式
            sc.Views.GanttView.AppointmentDisplayOptions.TimeDisplayType = AppointmentTimeDisplayType.Text;


            //显示颜色

            sc.Views.GanttView.Appearance.Dependency.ForeColor = Color.Red;

            sc.Views.GanttView.Appearance.SelectedDependency.ForeColor = Color.Blue;


            sc.Views.GanttView.Scales.Clear();//清空

            DevExpress.XtraScheduler.TimeScaleDay td = new TimeScaleDay();
            td.DisplayFormat = "yyyy-MM-dd";
            td.Enabled       = true;


            DevExpress.XtraScheduler.TimeScaleHour tm = new TimeScaleHour();
            tm.Enabled = true;


            sc.Views.GanttView.Scales.Add(td);
            sc.Views.GanttView.Scales.Add(tm);
        }
コード例 #5
0
ファイル: Frm_PR_LG_GTT2.cs プロジェクト: rcw0125/PCI20200819
        private void InitGrantView(DevExpress.XtraScheduler.SchedulerControl sc)
        {
            //设置资源
            sc.GroupType = SchedulerGroupType.Resource;

            //设置甘特图
            sc.ActiveViewType = SchedulerViewType.Gantt;

            //设置Resource 字体不旋转
            sc.OptionsView.ResourceHeaders.RotateCaption = false;
            sc.OptionsView.ResourceHeaders.Height        = 60;
            sc.OptionsView.ShowOnlyResourceAppointments  = true;

            sc.Start = DateTime.Now;

            sc.DataStorage.Appointments.Labels.Clear();
            var label1 = sc.DataStorage.Appointments.Labels.CreateNewLabel("1", "Label");

            label1.SetColor(Color.LightBlue);
            sc.DataStorage.Appointments.Labels.Add(label1);
            var label2 = sc.DataStorage.Appointments.Labels.CreateNewLabel("0", "Label");

            label2.SetColor(Color.Yellow);
            sc.DataStorage.Appointments.Labels.Add(label2);

            //禁止块冲突
            sc.OptionsCustomization.AllowAppointmentConflicts = AppointmentConflictsMode.Allowed;
            //不允许复制
            sc.OptionsCustomization.AllowAppointmentCopy = UsedAppointmentType.None;
            //不允许创建
            sc.OptionsCustomization.AllowAppointmentCreate = UsedAppointmentType.None;
            //不允许删除
            sc.OptionsCustomization.AllowAppointmentDelete = UsedAppointmentType.None;
            //不允许拖到
            sc.OptionsCustomization.AllowAppointmentDrag = UsedAppointmentType.None;
            //不允许不同资源间创建
            sc.OptionsCustomization.AllowAppointmentDragBetweenResources = UsedAppointmentType.None;
            //允许编辑
            //sc.OptionsCustomization.AllowAppointmentEdit = UsedAppointmentType.All;
            //不允许多个选择
            sc.OptionsCustomization.AllowAppointmentMultiSelect = false;
            //不允许改变大小
            sc.OptionsCustomization.AllowAppointmentResize = UsedAppointmentType.None;
            //不允许依赖窗体弹出
            sc.OptionsCustomization.AllowDisplayAppointmentDependencyForm = AllowDisplayAppointmentDependencyForm.Never;
            //允许Appointment窗体弹出
            sc.OptionsCustomization.AllowDisplayAppointmentForm = AllowDisplayAppointmentForm.Never;
            //不允许编辑文字
            sc.OptionsCustomization.AllowInplaceEditor = UsedAppointmentType.None;


            //设置Appointment 的高度不自适应
            //sc.Views.GanttView.AppointmentDisplayOptions.AppointmentAutoHeight = false;
            //高度
            sc.Views.GanttView.AppointmentDisplayOptions.AppointmentHeight = 40;
            //sc.Views.GanttView.AppointmentDisplayOptions.AppointmentInterspacing = 1;
            sc.Views.GanttView.AppointmentDisplayOptions.ContinueArrowDisplayType = AppointmentContinueArrowDisplayType.Never;
            //不显示开始时间
            sc.Views.GanttView.AppointmentDisplayOptions.StartTimeVisibility = AppointmentTimeVisibility.Never;
            //不显示结束时间
            sc.Views.GanttView.AppointmentDisplayOptions.EndTimeVisibility = AppointmentTimeVisibility.Never;
            //不显示进度条
            sc.Views.GanttView.AppointmentDisplayOptions.PercentCompleteDisplayType = PercentCompleteDisplayType.None;
            //不显示恢复
            sc.Views.GanttView.AppointmentDisplayOptions.ShowRecurrence = false;
            //不显示提醒
            sc.Views.GanttView.AppointmentDisplayOptions.ShowReminder    = false;
            sc.Views.GanttView.AppointmentDisplayOptions.SnapToCellsMode = AppointmentSnapToCellsMode.Never;
            //不显示状态
            sc.Views.GanttView.AppointmentDisplayOptions.StatusDisplayType = AppointmentStatusDisplayType.Never;
            //显示样式
            sc.Views.GanttView.AppointmentDisplayOptions.TimeDisplayType = AppointmentTimeDisplayType.Text;


            sc.Views.GanttView.Scales.Clear();//清空

            DevExpress.XtraScheduler.TimeScaleDay td = new TimeScaleDay();
            td.DisplayFormat = "yyyy-MM-dd";
            td.Enabled       = true;


            DevExpress.XtraScheduler.TimeScaleHour tm = new TimeScaleHour();
            tm.Enabled = true;


            sc.Views.GanttView.Scales.Add(td);
            sc.Views.GanttView.Scales.Add(tm);
        }