首页 技术 正文
技术 2022年11月15日
0 收藏 632 点赞 2,923 浏览 3239 个字

DevExpress 行事历(Scheduler)的常用属性、事件和方法

参考资料来源:附带的ExpressScheduler 2  Demo, 如想了解更多可以查看Demo.

一、TcxScheduler
【TcxScheduler常用属性】
1.Storage    – 邦定一个Storage为Scheduler显示提供数据

2.DateNavigate.ColCount  – 显示日历的列数
3.DateNavigate.RowCount  – 显示日历的行数. ColCount x RowCount 即显示日历数
4.DateNavigate.FirstWeekOfYear  – 一年的第1个星期
5.DateNavigate.ShowWeekNumbers  – 是否显示周数
6.DateNavigate.Visible  – 是否显示日历

7.OptionsView.ResourcePerPage  – 一页显示多少个Storage的Resources.Items(任务执行者)
8.OptionsView.WorkDays   – 指定一个星期的哪些天要上班
9.OptionsView.StartOfWeek  – 指定哪一天作为星期的第一天
10.OptionsView.WorkStart – 一天的上班开始时间
11.OptionsView.WorkFinish  – 一天的上班结束时间
12.OptionsView.ViewPosition  – View显示位置(左或右)

13.ViewDay.Active  – 以日的形式显示
14.ViewWeek.Active  – 以星期的形式显示
15.ViewTimeGrid   – 以时间横向显示
16.ViewYear.Active  – 以年的形式显示

【TcxScheduler常用事件】
1.OnLayoutChanged   – 日期改变、显示形式改变等触发
2.OnSelectionChanged    – 选择任务触发
3.DateNavigator.OnSelectionChanged – 选择的日期变化触发

【TcxScheduler常用方法】
1.SelectDays[0]   – 返回被选中的第1个日期
2.GoToDate(d1, vmMonth)  – 选中d1所在的月份, 并以某种形式显示
3.SelectedDays[n]  – 返回选中的第n个日期
4.SelectWorkDays(d1)  – 选中d1所在星期的工作日
5.FullRefresh   – 刷新

二、TcxSchedulerStorage

【TcxSchedulerStorage常用属性】
1.Resources.Items    – 增加任务的执行者。如:生产线、业务员….
2.Resources.Images   – 任务执行者的图片集(不是必要的)

【TcxSchedulerStorage常用方法】
1.BeginUpdate   – 开始增加任务
2.CreateEvent   – 增加任务
3.EndUpdate   – 结束增加任务

【TcxSchedulerStorage加载任务】
begin
  Screen.Cursor := crHourGlass;
  Storage.BeginUpdate;
  try
    //加入任务
    with Storage.createEvent do
    begin
      ResourceID := 执行者的ResourceID;
      Caption := ‘测试任务’;
      Start := StrToDateTime(‘2011/12/01 08:00’);     //开始时间
      Finish := StrToDateTime(‘2011/12/01 08:30’);    //结束时间
    end;
    //循环任务
    with Storage.createEvent do
    begin
      ResourceID := 执行者的ResourceID;
      Caption := ‘循环任务’;
      Duration := 45 * MinuteToTime;            //耗时
      MoveTo(Date + (8 + AResourceID) * HourToTime);   //开始时间. 当前日期 +8小明
      EventType := etPattern;                   //任务类型
      LabelColor := $51B0F7;                    //改Label颜色
      RecurrenceInfo.Count := -1;         //循环次数. -1为不限次数
      RecurrenceInfo.Recurrence := cxreWeekly;  //循环单位
      RecurrenceInfo.Periodicity := 1;          //循环周期
      RecurrenceInfo.OccurDays := [dWednesday, dSaturday]; //循环日期
      RecurrenceInfo.DayType := cxdtDay;
    end;
  finally
    Storage.EndUpdate;
    Scheduler.FullRefresh;
    Screen.Cursor := crDefault;
  end;
end;

【给TcxScheduler的日历加上底图或文字】
uses dxoffice11

procedure TfrmVSScheduler.SchedulerDateNavigatorCustomDrawContent(Sender: TObject;
  ACanvas: TcxCanvas; AViewInfo: TcxSchedulerDateNavigatorMonthContentViewInfo;
  var ADone: Boolean);
var
  ABitmap: TBitmap;
  AColor: TColor;
  R: TRect;
begin
  if 1 = 1 then
  begin
    //日历底图
    case AViewInfo.Month of
      3..5:
        ABitmap := cxSpringStyle.Bitmap;
      6..8:
        ABitmap := cxSummerStyle.Bitmap;
      9..11:
        ABitmap := cxAutumnStyle.Bitmap;
    else
      ABitmap := cxWinterStyle.Bitmap;
    end;
    ACanvas.Canvas.StretchDraw(AViewInfo.Bounds, ABitmap);
  end
  else begin
    //写文字
    R := AViewInfo.Bounds;
    case AViewInfo.Month of
      3..5: AColor := $D0FFD0;
      6..8: AColor := $D0D0FF;
      9..11: AColor := $D0FFFF;
    else
      AColor := $FFE7E7;
    end;
    with ACanvas do
    begin
      Brush.Color := AColor;
      FillRect(R);
      Font.Height := R.Bottom – R.Top;
      Font.Color := GetMiddleRGB(AColor, 0, 85);
      DrawText(IntToStr(AViewInfo.Month), R, cxAlignCenter);
    end;
    ACanvas.Font := AViewInfo.ViewParams.Font;
  end;
  //
  AViewInfo.Transparent := True;
  ADone := True;
end;

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,501
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,915
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,748
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,505
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,143
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,306