?
快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

1bet亦博官網娛樂:完成自編輯地Date Picker控件

?

運行情況:VC7, VC6, XP, W2K, Win9X, Win95, NT4, MFC

簡介

我想要這樣一個控件,既包括標準date picker控件的功能,又能讓用戶任何時刻都能自己輸入日期。標準的date picker控件有其自己的實現自編輯日期的措施,然則這并沒有達到我想要的。

文檔

此控件基于微軟的CDateTimeCtrl類,我應用了一些小技術用我自己的編輯控件和按鈕調換了標準的控件,然則處置懲罰類仍承襲于CDateTimeCtrl。為了實現這個功能,我銷毀了已存在的窗口,并且創建了一個與類相關聯的我自己的窗口。事情道理參看CDateTimeEditCtrl::OnRecreate。

基于我的實現措施,這個控件的應用與標準的CDateTimeCtrl完全一樣。在你的對話框資本中加入一個標準的Date picker控件,然后為其創建CDateTimeEditC1bet亦博官網娛樂trl類型的成員變量。

這個控件支持平日的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 behav1bet亦博官網娛樂iour 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 1bet亦博官網娛樂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 = NULL);

Sets the characters that are valid for the user to type into the edit con1bet亦博官網娛樂trol. If NULL is specified, then the default characters are used (0-9 and the current user\'s locale\'s date separator). If the user changes the locale settings then the control will detect this and use the new separator.

CString GetValidChars();

Returns the characters that have been set as being v1bet亦博官網娛樂alid for the user to type into the edit control

void SetAllowUpDownKeys(BOOL bAllow = TRUE);

Sets whether the up/down arrow keys will increment/decrement the part of the date string that contains the cursor.

BOOL GetAllowUpDownKeys();

Returns whether the up/down keys will increment/decrement parts of the date string.

免責聲明:以上內容源自網絡,版權歸原作者所有,如有侵犯您的原創版權請告知,我們將盡快刪除相關內容。

您可能還會對下面的文章感興趣:

河北十一选五开奖的 幸运龙宝贝 足球即时指数怎么看 新西兰4.5彩什么意思 sm三级片 股票涨跌影响总资产 十一选五山东一定牛 佐佐木明希黑人 福建快三 在线收看日韩a片 幸运农场 nba湖人vs凯尔特人 足彩 步行者中锋 足彩半全场 正在直播老鹰vs火箭 澳洲幸运8