c语言实现鼠标驱动,用C语言写的鼠标驱动程序.doc

程序运行效果截图:

运行环境:VC7, VC6, XP, W2K, Win9X, Win95, NT4, MFC

简介

我想要这样一个控件,既包括标准date picker控件的功能,又能让用户任何时候都能自己输入日期。标准的date picker控件有其自己的实现自编辑日期的方法,但是这并没有达到我想要的。

文档

此控件基于微软的CDateTimeCtrl类,我使用了一些小技巧用我自己的编辑控件和按钮替换了标准的控件,但是处理类仍继承于CDateTimeCtrl。为了实现这个功能,我销毁了已存在的窗口,并且创建了一个与类相关联的我自己的窗口。工作原理参看CDateTimeEditCtrl::OnRecreate。

基于我的实现方法,这个控件的使用与标准的CDateTimeCtrl完全一样。在你的对话框资源中加入一个标准的Date picker控件,然后为其创建CDateTimeEditCtrl类型的成员变量。

这个控件支持通常的Date picker风格,下面几个风格不支持:DTS_UPDOWN, DTS_SHOWNONE, DTS_APPCANPARSE, DTS_LONGDATEFORMAT, and DTS_TIMEFORMAT。

消息传递与标准控件一样,但是不支持DTM_GETRANGE, DTM_SETRANGE和DTM_SETFORMAT消息。控件中事件的通知与标准控件一样,发送给父窗口。

一些额外的公有函数也被加入以提供更强的功能扩展,这些公有函数列表如下:

BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);

与CDateTimeCtrl功能类似.

CEdit* GetEditControl() const;

返回一个指向编辑控件的指针,通过这个指针可以直接处理它的属性。

void EnableButton(BOOL bEnable = TRUE);

允许或禁止用来下拉calendar control的按钮

void RestoreFocus(BOOL bRestore = TRUE);

Determines the behaviour when clicking on the button. If TRUE then the control re-sets the focus back to the window whitch had the focus on clicking the button, else the focus is set to the edit control. If the control is not editable focus is always set back to the previously focused window. The default is for the focus to be set to the edit control.

void SetNonEditable(BOOL bNonEditable = TRUE);

Used to make the edit portion of the control non-editable. The default is editable.

BOOL GetNonEditable();

Returns whether the edit control is currently editable.

virtual BOOL IsValidDate(LPCTSTR lpszDate = NULL);

Returns whether the date string passed is valid. If lpszDate is NULL then it returns whether the text in the edit control is a valid date string.

void SetValidCharsOnly(BOOL bValidCharsOnly = TRUE);

Sets whether the user can only enter characters that are valid

BOOL GetValidCharsOnly();

Returns whether the user can only enter valid characters into the edit control

void SetValidChars(LPCTSTR lpszValidChars = N

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值