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
甘特图在项目管理中非常重要,甘特图的思想比较简单,即以图示的方式通过活动列表和时间刻度形象地表示出任何特定项目的活动顺序与持续时间.它直观地表明任务计划在什么时候进行,及实际进展与计划要求的对比.管理 ...
随机推荐
- 打破惯性思维:聊聊一次debug
最近公司的新需求中要增加活动营销,整个组的人都被安排去研究某成熟产品的实现.我也认真地在看webService部分的实现,发现了一个诡异的10614端口的请求. 代码如下图: 这是一段服务端发请求验证 ...
- Android中使用开源框架Fresco处理图片
本文为原创博文,转载请注明原文链接:http://www.cnblogs.com/panhouye/p/6278116.html 关于Fresco的优点大家自行谷歌吧,它太强大太优秀了,我这一片小博文 ...
- Linux系统下搭建DNS服务器——DNS原理总结
2017-01-07 整理 DNS原理 域名到IP地址的解析过程 IP地址到域名的反向域名解析过程 抓包分析DNS报文和具体解析过程 DNS服务器搭建和配置 这个东东也是今年博主参见校招的时候被很多公 ...
- Unity中使用协程进行服务端数据验证手段
近期在做项目中的个人中心的一些事情,用户头像上传,下载,本地缓存,二级缓存,压缩,这些都要做,麻雀虽小五脏俱全啊,也是写的浑浑噩噩的, 当我们在上传用户头像的时候,向服务端发送上传头像请求之前,一般都 ...
- Mac下使用charles遇到的问题以及解决办法
最近使用上了Charles,因为之前一直使用Fidder,所以还是碰到了一些问题,这里记录一下. 如何安装破解版 打开charles后,发现访问但是抓不到包 抓取HTTPS的接口,看response是 ...
- RPC 框架原理详解
首先了解什么叫RPC,为什么要RPC,RPC是指远程过程调用?也就是说两台服务器A,B,一个应用部署在A服务器上,想要调用B服务器上应用提供的函数/方法,由于不在一个内存空间,不能直接调用,需要通过网 ...
- 分布式缓存Memcached/memcached/memcache详解及区别
先来解释下标题中的三种写法:首字母大写的Memcached,指的是Memcached服务器,就是独立运行Memcached的后台服务器,用于存储缓存数据的“容器”.memcached和memcache ...
- apk反编译查看源码
1.将apk解压
- LCT
一个LCT看了一天了,但是很多地方还是理解的很模糊,简单谈一下理解. LCT支持的是对于森林的分裂.合并,以及查询节点的连通性等操作. 对于这片森林来说,它是由一坨树组成的,对于每一棵树,我们采用类似 ...
- magento里的session传值
1.$registrationCode = Mage::getSingleton('customer/session' )->setData('login_phone_code', $valid ...