Dev 甘特图
date1.EditValue = DateTime.Now.Date.AddDays().AddHours().AddMinutes().AddSeconds();
scLd1.PopupMenuShowing += schedulerControl1_PopupMenuShowing;
scLd1.EditAppointmentFormShowing += schedulerControl1_EditAppointmentFormShowing;
///增加额外字段 如备注
AppointmentCustomFieldMappingCollection appointCust = schedulerStorage1.Appointments.CustomFieldMappings;
appointCust.Add(new AppointmentCustomFieldMapping("Note", "Note"));
scLd1.GanttView.ResourcesPerPage = ; //设置资源个数
scLd1.InitAppointmentDisplayText += scLd1_InitAppointmentDisplayText; //自定义显示提示
SetToolTipControl(scLd1);
SetLabeColor(scLd1.Storage);
InitGrantView(scLd1);
}
/// <summary>
/// 设置提示
/// </summary>
/// <param name="sc"></param>
private void SetToolTipControl(DevExpress.XtraScheduler.SchedulerControl sc)
{
ToolTipController toolTipController1 = new ToolTipController();
toolTipController1.AllowHtmlText = true;
toolTipController1.BeforeShow += toolTipController1_BeforeShow;
sc.ToolTipController = toolTipController1;
}
/// <summary>
/// 设置Appointment颜色
/// </summary>
/// <param name="ss"></param>
private void SetLabeColor(DevExpress.XtraScheduler.SchedulerStorage ss)
{
///设置块的颜色
ss.Appointments.Labels.Clear();
ss.Appointments.Labels.Add(new DevExpress.XtraScheduler.AppointmentLabel(Color.Yellow, "生产中"));
ss.Appointments.Labels.Add(new DevExpress.XtraScheduler.AppointmentLabel(Color.LightBlue, "生产完成"));
ss.Appointments.Labels.Add(new DevExpress.XtraScheduler.AppointmentLabel(Color.Red, "回炉"));
ss.Appointments.Labels.Add(new DevExpress.XtraScheduler.AppointmentLabel(Color.Maroon, "其它"));
}
/// <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 = ;
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.Auto;
//不允许编辑文字
sc.OptionsCustomization.AllowInplaceEditor = UsedAppointmentType.None;
//GrantView
sc.Views.GanttView.CellsAutoHeightOptions.Enabled = true;//设置单元格不自适应高度
sc.Views.GanttView.CellsAutoHeightOptions.MinHeight = ;//设置最小高度
//设置Appointment 的高度不自适应
sc.Views.GanttView.AppointmentDisplayOptions.AppointmentAutoHeight = true;
sc.Views.GanttView.AppointmentDisplayOptions.AppointmentHeight = ;
sc.Views.GanttView.AppointmentDisplayOptions.AppointmentInterspacing = ;
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.TimeScale15Minutes tm = new TimeScale15Minutes();
tm.Enabled = true;
sc.Views.GanttView.Scales.Add(td);
sc.Views.GanttView.Scales.Add(tm);
}
void scLd1_InitAppointmentDisplayText(object sender, AppointmentDisplayTextEventArgs e)
{
Appointment apt = e.Appointment;
e.Text = GetCustomSubject(apt);
}
string GetCustomSubject(Appointment apt)
{
string s = apt.Subject;
if (apt.Location.Length > )
{
s += String.Format("\r\n[{0}]", apt.Location);
}
return s;
}
void toolTipController1_BeforeShow(object sender, ToolTipControllerShowEventArgs e)
{
ToolTipController controller = sender as ToolTipController;
AppointmentViewInfo aptViewInfo = controller.ActiveObject as AppointmentViewInfo;
if (aptViewInfo == null) return;
var app = aptViewInfo.Appointment;
e.IconType = ToolTipIconType.Information;
e.Title = app.Subject;
e.ToolTip = string.Format("{0},{1}", app.Location, app.CustomFields["Note"]);
}
/// <summary>
/// 清空菜单,自定义菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void schedulerControl1_PopupMenuShowing(object sender, DevExpress.XtraScheduler.PopupMenuShowingEventArgs e)
{
//DXMenuItem item = new DXMenuItem("菜单项");
if (scLd1.ActiveViewType == DevExpress.XtraScheduler.SchedulerViewType.Day)//不同view展示不同菜单项
{
}
if (e.Menu.Id == DevExpress.XtraScheduler.SchedulerMenuItemId.DefaultMenu)//右键空白处
{
e.Menu.Items.Clear();
}
if (e.Menu.Id == DevExpress.XtraScheduler.SchedulerMenuItemId.AppointmentMenu)//appointment 上右键
{
e.Menu.Items.Clear();
//e.Menu.Items.Add(item);
}
}
private void schedulerControl1_EditAppointmentFormShowing(object sender, DevExpress.XtraScheduler.AppointmentFormEventArgs e)
{
DevExpress.XtraScheduler.SchedulerControl scheduler = ((DevExpress.XtraScheduler.SchedulerControl)(sender));
using( AppiontmentForm form = new AppiontmentForm(scheduler, e.Appointment, e.OpenRecurrenceForm))
{
form.ShowDialog();
e.Handled = true;
}
}
设置绑定数据资源类 ,设置Appointment类,设置依赖关系类。具体字体参考Mapping的设置。
Dev 甘特图的更多相关文章
- Twproject Gantt开源甘特图功能扩展
1.Twproject Gantt甘特图介绍 Twproject Gantt 是一款基于 jQuery 开发的甘特图组件,也可以创建其它图表,例如任务树(Task Trees).内置编辑.缩放和 CS ...
- 从零开始编写自己的C#框架(10)——项目实施计划与甘特图
不知不觉本系列已经写了一个月,编码前的各项工作到此也终于结束了.回头看看这一个月走过来,白天上班晚上码字查资料,写写改改,挺不容易的.很多时候有些知识会用,知道是怎么回事,但并不等于能写出来.错别字. ...
- java实现甘特图的2种方法:SwiftGantt和Jfree (转)
http://blog.sina.com.cn/s/blog_50a7c4a601009817.html 第一种方法使用SwiftGantt实现甘特图(进度图推荐这个) import java.a ...
- 使用Excel 2007绘制甘特图
本文将教大家如何使用Excel 2007制作甘特图.Excel并未提供甘特图类型,但还是可以绘制甘特图的,方法就是通过对堆积条形图类型进行自定义,使之显示任务.任务工期和层次结构. 下面的过程可帮助创 ...
- jquery 甘特图开发指南
JQuery.Gantt是一个开源的基于JQuery库的用于实现甘特图效果的可扩展功能的JS组件库. <link rel="stylesheet" href="cs ...
- gantt甘特图的制作过程
甘特图主要是用来做项目管理的,可以清楚的看到任务间的逻辑关系,任务与时间关系和任务间并行关系. 在甘特图中,横轴方向表示时间,纵轴方向并列着活动列表.图表内可以用线条.数字.文字代号等来表示计划(实际 ...
- JS中可拖拽的甘特图和流程图
甘特图: https://www.douban.com/note/441706674/ https://www.uedsc.com/jquery-ganttview.html https://gith ...
- WindowsForm如何实现类似微软project软件的甘特图?
在管理软件研发过程中,特别是涉及项目管理或者生产计划方面,都需要一款类似微软project的控件对项目下的分解任务进行图形展示(甘特图).下面介绍一下在WindowsForm下如何实现类似微软proj ...
- 一款开源且功能强大的C#甘特图控件.NET Winforms Gantt Chart Control
甘特图在项目管理中非常重要,甘特图的思想比较简单,即以图示的方式通过活动列表和时间刻度形象地表示出任何特定项目的活动顺序与持续时间.它直观地表明任务计划在什么时候进行,及实际进展与计划要求的对比.管理 ...
随机推荐
- 浅析flannel与docker结合的机制和原理
flannel flannel可以为容器提供网络服务. 其模型为全部的容器使用一个network,然后在每个host上从network中划分一个子网subnet. 为host上的容器创建网络时,从su ...
- 数据库(MySQL)表基本操作
数据库表基本操作 思前想后,最终还是把博客的名字改成了数据库表基本操作,以前叫SQL语句大全,感觉用"大全"这个名词 ...
- 关于ABP——领域服务的思考
我在刚接触ABP的时候一直有一个疑问--有了应用服务,为什么还需要领域服务呢? 领域服务和应用服务对比 领域服务 应用服务 返回值 Entity DTO 被表现层调用 不可以(非强制) 可以 在ABP ...
- ASP.NET网站运行常见错误以及解决方法(持续更新)
一.A potentially dangerous Request.Form value was detected from the client 用户在页面上提交表单到服务器时,服务器会检测到一些潜 ...
- 结构-行为-样式-css&html横纵居中最佳实践
最近在做手机端的H5项目,有个标题是在一根横线中的,就是水平居中加垂直居中(如图一).这应该是前端开发中经常遇到的一个场景了,做的次数多了就有一些体会,我今天就总结了下这种结构的实现思路:首先,用元素 ...
- 软件各种版本的含义!例如RC,M,GA等等
RC版本 RC:(Release Candidate) Candidate是候选人的意思,用在软件上就是候选版本.Release是发行.发布的意思.Release.Candidate.就是发行 ...
- Debian安装 ss-qt5
Kali Linux 基于 Debian ,安装时得参考 Debian 安装方法,用 Ubuntu 的方法装不上.官方安装指南这样说: Debian安装指南 然而在执行 sudo apt-get in ...
- 【NOIP2012】DAY1+DAY2题解
不贴代码的原因是我的代码在初中机房.忘记带过来了. DAY 1 T1随便搞,但是字符串相关的题我经常犯蠢 T2 一个结论题,OAO但是需要高精度写. 具体就是按左手的数除右手的数(还是怎么的来着)排个 ...
- 使用Egret Conversion 转化as代码到ts代码
1,转换时,如果一次转化代码文件太多,可能会出现错误,可以一次少转几个文件: 2,如果出现所转换文件中有错误,则需修改要转换文件: 3,转换时还可能生成新文件夹如elex,转换的ts文件就会存在ele ...
- OpenCV入门教程
OpenCV入门教程 作者:于仕琪 OpenCV入门教程.pdf