TIWCalendar: 日历控件, 继承于 TIWCustomGrid, 所以它和 TIWGrid 共同属性特多.

它的 Cell 是 TIWCalendarCell 对象, 直接从 TIWGridCell 继承.


TIWCalendar 所在单元及继承链:
IWCompCalendar.TIWCalendar

主要成员:


property Cell[const ARow: Integer, const AColumn: Integer]: TIWCalendarCell //
property CurrentDayImage: TIWFileReference //显示在当前日期的图片
property CaptionToday: string //当前日期的附加标题
property PreviousMonthImage: TIWFileReference //"后退"图片
property NextMonthImage: TIWFileReference //"前进"图片
property CaptionPrevious: string //"后退"标题
property CaptionNext: string //"前进"标题
property CalendarHeaderColor: TIWColor //标题背景色
property CalendarColor: TIWColor //背景色
property AlternateCalendarColor: TIWColor //用于交替的背景色
property CheckerBoard: Boolean //是否使用交替背景
property CalendarHeaderFont: TIWFont //标题字体
property CalendarFont: TIWFont //字体
property StartDate: TDateTime //默认当前日期
property SelectedDate: TDateTime //就是刚刚点过的日期
property DisplayYear: Boolean //是否显示"年"
property LocaleID: Integer //本地语言 ID property CellRenderOptions: TIWCellRenderOptions //
property BorderColors: TIWGridBorderColors //
property BGColor: TIWColor //
property BorderSize: Integer //
property BorderStyle: TIWGridBorderStyle //
property Caption: TCaption //
property CellPadding: Integer //
property CellSpacing: Integer //
property Font: TIWFont //
property Lines: TIWGridLines //
property Summary: string //
property UseFrame: Boolean //
property UseSize: Boolean //
property HiddenColumns: TStringList // property OnDateChange: TIWCalendarDateChange //
property OnGetDateInformation: TIWCalendarGetDateInformation //
property OnGetDayNames: TIWCalendarGetDayNames //
property OnGetMonthName: TIWCalendarGetMonthName //
property OnRenderCell: TIWOnRenderCell //
property OnRender: TNotifyEvent //
property OnGetCellRenderOptions: TIWGetCellRenderOptionsEvent // procedure SetHeaderCells; //
function IsRowVisible(ARow: Integer): Boolean //
procedure SetColumnVisibility(AColumn: Integer; AVisible: Boolean) //

TIWCalendarCell:


{IWCompCalendar.TIWCalendarCell

改控件拖到窗体上就能用, 如果要写一行代码的话应该是: IWCalendar1.StartDate := Date; 下面是个比较全面的测试:

var
gInfoList: TStrings; //用于记录自定义的备忘信息 procedure TIWForm1.IWAppFormCreate(Sender: TObject);
begin
gInfoList := TStringList.Create; //如果是长期保存, 它应该是从服务器上读取某个文件 IWCalendar1.Caption := ''; //标题无用
IWCalendar1.CaptionPrevious := '>'; IWCalendar1.CalendarHeaderColor := $88aaaa; IWCalendar1.CalendarColor := $eeffff;
IWCalendar1.AlternateCalendarColor := $ccdddd; //交替颜色
IWCalendar1.CheckerBoard := True; //确认使用指定的 "交替颜色" 与背景色交替使用 IWCalendar1.CalendarFont.Size := 12;
LinkColor := $0033dd; //Cell 中的文本其实成了链接了, 如果要改变 Cell 中文本的显示, 最好使用 Css IWCalendar1.CaptionToday := '★'; //突出标示当前日期, 或使用图像(CurrentDayImage) IWCalendar1.StartDate := Date; //显然使用 Date 比 Now 更合理; 这句还能起到刷新的作用
end; {通过 OnGetDayNames 事件调整周标题显示}
procedure TIWForm1.IWCalendar1GetDayNames(var Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday: string);
begin
Sunday := '周末';
end; {通过 OnGetMonthName 事件调整月份显示}
procedure TIWForm1.IWCalendar1GetMonthName(MonthNumber: Integer; var MonthName: string);
begin
MonthName := MonthNumber.ToString + '月';
end; {通过 OnRenderCell 事件调整更多显示细节}
procedure TIWForm1.IWCalendar1RenderCell(ACell: TIWGridCell; const ARow, AColumn: Integer);
begin
{让当前选定的日期在字号上有所区别}
if TIWCalendarCell(ACell).CellDate = TIWCalendar(ACell.Grid).SelectedDate then
ACell.Font.Size := 14
else
ACell.Font.Size := ACell.Grid.Font.Size; {ARow = 0 是最上面一行, 也就是带月导航的那行}
if ARow = 0 then ACell.Font.Size := 13;
{Arow = 1 是周标题}
if ARow = 1 then ACell.Height := '20'; //Height 是 字符串在 Html 中不难理解
end; {添加和日期关联的备注信息}
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
gInfoList.Values[FormatDateTime('ddmmyyyy', IWCalendar1.SelectedDate)] := IWMemo1.Text;
end; {选择不同日期时再取回备注信息}
procedure TIWForm1.IWCalendar1DateChange(ADate: TDateTime);
begin
IWMemo1.Text := gInfoList.Values[FormatDateTime('ddmmyyyy', ADate)];
end; {通过切换月份, 可以看到刚添加的与日期关联的备注信息}
procedure TIWForm1.IWCalendar1GetDateInformation(ADate: TDateTime; VInformation: TStrings);
begin
VInformation.Text := gInfoList.Values[FormatDateTime('ddmmyyyy', ADate)];
end; procedure TIWForm1.IWAppFormDestroy(Sender: TObject);
begin
gInfoList.Free;
end;

效果图:


使用 IntraWeb (22) - 基本控件之 TIWCalendar的更多相关文章

  1. 使用 IntraWeb (24) - 基本控件之 TIWFileUploader、TIWFile

    TIWFileUploader 是基于 Ajax 的上传控件, 最初是 Andrew Valums 开发, 从 IntraWeb XIV 纳入并替换 TIWFile. 虽然从组件面板上还能看到 TIW ...

  2. 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent

    TIWAutherList //通过一组户名与密码验证登陆 TIWAutherINI //通过记录户名与密码信息的 #Auth.ini 文件验证登陆 TIWAutherEvent //通过其 OnCh ...

  3. 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm

    TIWTemplateProcessorHTML //使用外部的 html 文件做模板 TIWLayoutMgrHTML //直接输入 Html 文本做模板 TIWLayoutMgrForm //这应 ...

  4. 使用 IntraWeb (26) - 基本控件之 TIWMenu

    TIWMenu 的任务是让原来的 TMainMenu 呈现在网页上, 通过其 AttachedMenu 属性关联一个 TMainMenu 是必需的. TIWMenu 所在单元及继承链: IWCompM ...

  5. 使用 IntraWeb (25) - 基本控件之 TIWRegion

    这应该是 IW 中最重要的容器了, 和它同父的还有 TIWTabControl TIWRegion 所在单元及继承链: IWRegion.TIWRegion 主要成员: property Align: ...

  6. 使用 IntraWeb (23) - 基本控件之 TIWTimer、TIWProgressBar、TIWProgressIndicator、TIWTimeEdit

    TIWTimer //和 TTimer 没多大区别, 它的默认事件现在是异步的(OnAsyncTimer), 在网络上使用 OnTimer 肯定是非常糟糕的 TIWProgressBar //进度条 ...

  7. 使用 IntraWeb (20) - 基本控件之 TIWGrid

    TIWGrid 最终通过 Html Table 呈现; 其每个 Cell 都是一个 TIWGridCell 对象, Cell 对象的 Control 属性非常好, 可以非常方便地嵌入其他控件. TIW ...

  8. 使用 IntraWeb (19) - 基本控件之 TIWTreeView

    这是个饱受非议的控件; 我通过尝试, 理解了非议, 也能理解作者. 总之向作者的思路靠拢吧, 还是不错的. TIWTreeView 所在单元及继承链: IWCompTreeview.TIWTreeVi ...

  9. 使用 IntraWeb (16) - 基本控件之 TIWList、TIWListbox、TIWComboBox、TIWOrderedListbox

    TIWList //列表; 它对应 Html 中的 OL.LI(某些选项下会用表格模拟); TIWListbox 和 TIWComboBox 则对应 Html 在的 Option TIWListbox ...

随机推荐

  1. [整理]ASP.NET WEB API 2学习

    目录 1 快速入门 1.1实例 1.1.1初识WEB API 2 1.1.2 Action Results 的改变 1.1.3 路由的新增特性 1.1.4 消息管道的变化 1.1.4.1 HttpMe ...

  2. linq中let关键字学习

    linq中let关键字就是对子查询的一个别名,let子句用于在查询中添加一个新的局部变量,使其在后面的查询中可见. linq中let关键字实例 1.传统下的子查询与LET关键字的区别     C# 代 ...

  3. JQuery 对表格的详细操作

    <%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding=& ...

  4. Dream------Hadoop--网络拓扑与Hadoop--摘抄

    两个节点在一个本地网络中被称为“彼此的近邻”是什么意思?在高容量数据处理中,限制因素是我们在节点间 传送数据的速率-----带宽很稀缺.这个想法便是将两个节点间的带宽作为距离的衡量标准.   衡量节点 ...

  5. JS判断客户浏览器是否是IE8浏览器、jQuery判断浏览器内核

    今天在使用encharts的时候由于要兼容IE8,所以最终决定在非IE8浏览器使用encharts,在IE8使用amcharts.于是需要使用JS判断使用的浏览器版本: function IEVers ...

  6. 通过图片获取gps地理位置

    别人说通过一张照片就可以定位你的位置,看来个视频,仔细研究了一下自己的照片没想到真的可以做到,想想真的有点可怕. 如何通过一张照片去定位这张照片的经纬度下面我以我手机中的照片为例. 我们通过pytho ...

  7. 【源码阅读】Mimikatz相关资料

    Mimikatz GitHub (源码) https://github.com/gentilkiwi/mimikatz Mimikatz GitHub Wiki (包含了一些说明文档) https:/ ...

  8. svn 回退/更新/取消至某个版本命令详解【转】

    转自:http://www.cnblogs.com/mfryf/p/4654110.html 1. 取消Add/Delete 取消文件 svn revert 文件名 取消目录 svn revert - ...

  9. linux C守护进程编写

    linux编程-守护进程编写 守护进程(Daemon)是运行在后台的一种特殊进程.它独立于控制终端并且周期性地执行某种任务或等待 处理某些发生的事件.守护进程是一种很有用的进程. Linux的大多数服 ...

  10. 『记录』Android参考资料

    欢迎留言推荐好的教程.资料.博客及作者等. 『记录』Android参考资料 1.前期环境 Android Studio使用Git Android Studio快捷键总结 Android Studio及 ...