继承Tcalendar控件,让当天日期醒目显示
一、新建一控件
打开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控件,让当天日期醒目显示的更多相关文章
- Android自定义日历控件(继承系统控件实现)
Android自定义日历控件(继承系统控件实现) 主要步骤 编写布局 继承LinearLayout设置子控件 设置数据 继承TextView实现有圆圈背景的TextView 添加Attribute 添 ...
- 在MonthCalendar控件中选中日期
Calendar.MONTH Calendar now=Calendar.getInstance();System.out.print(now.get(Calendar.MONTH));得到的月份少1 ...
- Android 自定义View 三板斧之一——继承现有控件
通常情况下,Android实现自定义控件无非三种方式. Ⅰ.继承现有控件,对其控件的功能进行拓展. Ⅱ.将现有控件进行组合,实现功能更加强大控件. Ⅲ.重写View实现全新的控件 本文重点讨论继承现有 ...
- C#继承基本控件实现自定义控件
C#继承基本控件实现自定义控件 摘自:http://www.cnblogs.com/greatverve/archive/2012/04/25/user-control-inherit.html 自定 ...
- C#继承基本控件实现自定义控件 (转帖)
自定义控件分三类: 1.复合控件:基本控件组合而成.继承自UserControl 2.扩展控件:继承基本控件,扩展一些属性与事件.比如继承Button 3.自定义控件:直接继承自Control 第一种 ...
- delphi中DateTimePicker控件同时输入日期和时间
将DateTimePicker的Format属性中加入日期格式设成 'yyyy-MM-dd HH:mm',注意大小写 , 将kind设置为dtkTime即可,可以在每次Form onShow时将Dat ...
- WinForm控件TreeView 只部分节点显示 CheckBox
WinForm控件TreeView 只部分节点显示 CheckBox 用过asp.net的应该知道,要在treeview中实现上述功能可以使用ShowCheckBox 属性指定那些节点显示check ...
- Scroll View 控件以Thumbnail的方式显示一个目录的全部图片,相似图片浏览器
MAC : XCode -> Scroll View 控件以Thumbnail的方式显示一个目录的全部图片,类似图片浏览器 STEP1:将两个目录复制到project里面ImageBrowser ...
- android内部培训视频_第三节(3)_常用控件(ViewPager、日期时间相关、ListView)
第三节(2):常用控件之ViewPager.日期时间相关.ListView 一.ViewPager 实例:结合PagerAdapter滑动切换图片 二.日期时间相关:AnalogClock\Dig ...
随机推荐
- WorldWind源码剖析系列:日志类Log
Utility工程中的日志类Log主要用来输出Debug状态下的调试信息.该类的类图如下: 日志类Log中使用到的类和内嵌结构体类型主要有以下这些: public class LogEventArgs ...
- opencv中的bitwise_not,bitwise_xor,bitwise_or,bitwise_and的使用方法与效果。
1.将二指图片的效果反转既黑色变白色,白色变黑色. 使用 bitwise_not(InputArray src, OutputArray dst, InputArray mask = noArray( ...
- 自己设计一个日期类,可以输入年月日作为构造时的参数,如果不使用参数,则设定为1900年1月1日;编写一个方法equals判断两个日期是否相等;另一个方法compareTo可以进行日期之间的比较,返回两个日期之间相差的天数.
import java.util.*; import java.lang.Math; class Date1{ private int year; private int month; private ...
- 基于LBS平台的iOS开发
LBS,即Location Based Services,基于位置服务,用于定位.导航等功能,比如地图应用.订外卖等的app就需要这个功能. 在这里我使用的是高德LBS开放平台,地址:http://l ...
- Ubuntu学习总结-01 安装Ubuntu
Ubuntu(友帮拓.优般图.乌班图)是一个以桌面应用为主的开源GNU/Linux操作系统,Ubuntu 是基于Debian GNU/Linux,支持x86.amd64(即x64)和ppc架构,由全球 ...
- 20155236范晨歌_Web安全基础实践
20155236范晨歌_Web安全基础实践 目录 实践目标 WebGoat BurpSuite Injection Flaws Cross-Site Scripting (XSS) 总结 实践目标 ( ...
- Spring集成Swagger,Java自动生成Api文档
博主很懒... Swagger官网:http://swagger.io GitHub地址:https://github.com/swagger-api 官方注解文档:http://docs.swagg ...
- MView的DDL查找:
Select dbms_metadata.get_ddl('MATERIALIZED_VIEW','MVIEW_NAME') from dual:
- LOJ#2799. 「CCC 2016」生命之环
题意 给你一个 \(n\) 个 \(\rm 01\) 组成的环,每次操作之后每个位置为1当且仅当他的左右恰好有1个1.输出进行 \(T\) 次操作之后的环. \(n\leq 10^5, T\leq 1 ...
- (幼儿园毕业)Javascript小学级随机生成四则运算
软件工程第二次结对作业四则运算自动生成器网页版 一.题目要求 本次作业要求两个人合作完成,驾驶员和导航员角色自定,鼓励大家在工作期间角色随时互换,这里会布置两个题目,请各组成员根据自己的爱好任选一题. ...