一、新建一控件

打开Delphi主菜单Cpmponent—New Cpmponent:

二、配置参数

点击OK键,打开Unit单元文件。

三、修改单元文件

unit LyCalendar;

interface

uses

Windows,

Messages, SysUtils, Variants, Classes, Graphics, Controls, //Forms,

Dialogs, Grids, Calendar, ComCtrls, StdCtrls,DateUtils;

type

TLyCalendar = class(TCalendar)

private

{Private declarations }

protected

{Protected declarations }

procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState:TGridDrawState); override;

public

{Public declarations }

published

{Published declarations }

end;

procedure Register;

implementation

procedure Register;

begin

RegisterComponents('LyComMy', [TLyCalendar]);

end;

procedure TLyCalendar.DrawCell(ACol, ARow:Integer; ARect: TRect; AState: TGridDrawState);

var  TheText: string;

vDay: string;

begin

TheText := CellText[ACol, ARow];

vDay := IntToStr(DateUtils.DayOf(Now));

ifvDay = TheText then

begin

//当天显示样式

Canvas.Font.Color := clRed;

Canvas.Font.Style:=Canvas.Font.Style+[fsBold];

end

else begin

//被选择日期显示样式

if  (gdSelected in AState) or(gdFocused in AState) then

begin

Canvas.Brush.Color := clBlue;

end;

end;

inherited;

end;

end.

四、安装控件

1、将新的单元文件,存入C:\ProgramFiles\Borland\Delphi7\Projects\Bpl\ 目录;

2、打开Delphi主菜单Cpmponent—Insert  Cpmponent:

3、指定安装的参数:

按“OK”键,打开对话框:

按“compile”键,完成安装。

四、新的控件样式:

五、源码下载地址:http://download.csdn.net/detail/lyhoo163/9631356  点击打开链接

继承Tcalendar控件,让当天日期醒目显示的更多相关文章

  1. Android自定义日历控件(继承系统控件实现)

    Android自定义日历控件(继承系统控件实现) 主要步骤 编写布局 继承LinearLayout设置子控件 设置数据 继承TextView实现有圆圈背景的TextView 添加Attribute 添 ...

  2. 在MonthCalendar控件中选中日期

    Calendar.MONTH Calendar now=Calendar.getInstance();System.out.print(now.get(Calendar.MONTH));得到的月份少1 ...

  3. Android 自定义View 三板斧之一——继承现有控件

    通常情况下,Android实现自定义控件无非三种方式. Ⅰ.继承现有控件,对其控件的功能进行拓展. Ⅱ.将现有控件进行组合,实现功能更加强大控件. Ⅲ.重写View实现全新的控件 本文重点讨论继承现有 ...

  4. C#继承基本控件实现自定义控件

    C#继承基本控件实现自定义控件 摘自:http://www.cnblogs.com/greatverve/archive/2012/04/25/user-control-inherit.html 自定 ...

  5. C#继承基本控件实现自定义控件 (转帖)

    自定义控件分三类: 1.复合控件:基本控件组合而成.继承自UserControl 2.扩展控件:继承基本控件,扩展一些属性与事件.比如继承Button 3.自定义控件:直接继承自Control 第一种 ...

  6. delphi中DateTimePicker控件同时输入日期和时间

    将DateTimePicker的Format属性中加入日期格式设成 'yyyy-MM-dd HH:mm',注意大小写 , 将kind设置为dtkTime即可,可以在每次Form onShow时将Dat ...

  7. WinForm控件TreeView 只部分节点显示 CheckBox

    WinForm控件TreeView 只部分节点显示  CheckBox 用过asp.net的应该知道,要在treeview中实现上述功能可以使用ShowCheckBox 属性指定那些节点显示check ...

  8. Scroll View 控件以Thumbnail的方式显示一个目录的全部图片,相似图片浏览器

    MAC : XCode -> Scroll View 控件以Thumbnail的方式显示一个目录的全部图片,类似图片浏览器 STEP1:将两个目录复制到project里面ImageBrowser ...

  9. android内部培训视频_第三节(3)_常用控件(ViewPager、日期时间相关、ListView)

    第三节(2):常用控件之ViewPager.日期时间相关.ListView  一.ViewPager 实例:结合PagerAdapter滑动切换图片  二.日期时间相关:AnalogClock\Dig ...

随机推荐

  1. leetcode70—Climbing Stairs

    You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...

  2. leetcode18—4Sum

    Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums s ...

  3. JS输入框邮箱自动提示(带有demo和源码)

    今天在javascriptQQ群里面 有童鞋问到 有没有 "JS输入框邮箱自动提示"插件,即说都找遍了github上源码 都没有看到这样类似的插件,然后我想了下 "JS输 ...

  4. Python2.7-operator

    operator 模块,没有什么特殊的,简单说就是把常用的数学计算符号(+,-,*,**,/,<<,>>等)逻辑运算(or,and,xor,is,is_not)等以函数形式表示 ...

  5. POJ 3687 Labeling Balls(反向拓扑+贪心思想!!!非常棒的一道题)

    Labeling Balls Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16100   Accepted: 4726 D ...

  6. php实现远程网络文件下载到服务器指定目录(方法二)

    <?php // maximum execution time in seconds set_time_limit (24 * 60 * 60); //if (!isset($_POST['su ...

  7. C# WPF xml序列化 反序列化

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...

  8. Exp4 恶意代码分析 20155223

    Exp4 恶意代码分析 20155223 使用原生命令schtasks监视系统运行 在系统盘目录下建立脚本文件netstatlog.bat,包含以下命令: date /t >> c:\ne ...

  9. spring配置多个事务管理器

    <tx:annotation-driven/> <bean id="transactionManager1" class="org.springfram ...

  10. OpenCV实战:人脸关键点检测(FaceMark)

    Summary:利用OpenCV中的LBF算法进行人脸关键点检测(Facial Landmark Detection) Author:    Amusi Date:       2018-03-20 ...