資源簡介
啟動參數使用1MBps,標準幀,自測模式,當點擊“Open device”時,即打開并啟動CAN,勾選“CAN receive”來啟動接收線程,點擊“Send”發送界面配置的CAN數據幀。
詳情請參見源代碼。
代碼片段和文件信息
//?ColoredListCtrl.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“ColoredListCtrl.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CColoredListCtrl
CColoredListCtrl::CColoredListCtrl()
{
m_colRow1?=?RGB(200200250);
m_colRow2?=?RGB(230247247);
// m_colRow1?=?RGB(240247249);
// m_colRow2?=?RGB(229232239);
}
CColoredListCtrl::~CColoredListCtrl()
{
}
BEGIN_MESSAGE_MAP(CColoredListCtrl?CListCtrl)
//{{AFX_MSG_MAP(CColoredListCtrl)
ON_WM_ERASEBKGND()
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW?OnCustomDraw)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CColoredListCtrl?message?handlers
void?CColoredListCtrl::OnCustomDraw(NMHDR*?pNMHDR?LRESULT*?pResult)
{
??*pResult?=?0;
??LPNMLVCUSTOMDRAW??lplvcd?=?(LPNMLVCUSTOMDRAW)pNMHDR;
??int?iRow?=?lplvcd->nmcd.dwItemSpec;
??switch(lplvcd->nmcd.dwDrawStage)
??{
????case?CDDS_PREPAINT?:
????{
??????*pResult?=?CDRF_NOTIFYITEMDRAW;
??????return;
????}
????//?Modify?item?text?and?or?background
????case?CDDS_ITEMPREPAINT:
????{
??????lplvcd->clrText?=?RGB(000);
??????//?If?you?want?the?sub?items?the?same?as?the?item
??????//?set?*pResult?to?CDRF_NEWFONT
????????if(ItemColorFlag[iRow]){
?????????lplvcd->clrTextBk?=?m_colRow2;
????????}
????????else{
??????????lplvcd->clrTextBk?=?m_colRow1;
????????}
??????*pResult?=CDRF_NOTIFYSUBITEMDRAW;
??????return;
????}
????//?Modify?sub?item?text?and/or?background
????case?CDDS_SUBITEM?|?CDDS_PREPAINT?|?CDDS_ITEM:
????{
/* //if(*(ItemColorFlag+nextrow)){
????????if(ItemColorFlag[iRow]){
?????????lplvcd->clrTextBk?=?m_colRow2;
????????}
????????else{
??????????lplvcd->clrTextBk?=?m_colRow1;
????????}
*/
????????*pResult?=?CDRF_DODEFAULT;
????????return;
????}
??}
??/*
?void?CCoolList::OnCustomDraw(NMHDR?*pNMHDR?LRESULT?*pResult){//類型安全轉換
NMLVCUSTOMDRAW*?pLVCD?=?reinterpret_cast(pNMHDR);
*pResult?=?0;//指定列表項繪制前后發送消息
if(CDDS_PREPAINT?==?pLVCD->nmcd.dwDrawStage)
{*pResult?=?CDRF_NOTIFYITEMDRAW;}
else?if(CDDS_ITEMPREPAINT?==?pLVCD->nmcd.dwDrawStage)
{//奇數行
if(pLVCD->nmcd.dwItemSpec?%?2)
pLVCD->clrTextBk?=?RGB(255?255?128);//偶數行
else?
pLVCD->clrTextBk?=?RGB(128?255?255);//繼續*pResult?=?CDRF_DODEFAULT;}}??
);//繼續
*pResult?=?CDRF_DODEFAULT;}}
*/
}
BOOL?CColoredListCtrl::OnEraseBkgnd(CDC*?pDC)?
{
//?TODO:?Add?your?message?handler?code?here?and/or?call?default
//return?TRUE;
??CRect?rect;
??CColoredListCtrl::GetClientRect(rect);
//??POINT?mypoint;??
??
?//?CBrush?brush0(m_colRow1);
??CBrush?brush1(m_colRow2);
?
?int?chunk_height=GetCountPerPage();
?pDC->FillRect(&rect&brush1);
/*
?for?(int?i=0;i<=chunk_height;i++)
?{
GetItemPosition(i&mypoint);
rect.top=mypoint.y?;
GetItemPosition(i+1&mypoint);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????3189??2007-04-18?23:11??ColoredListCtrl.cpp
?????文件????????1376??2007-12-04?23:26??ColoredListCtrl.h
?????文件???????38912??2020-04-16?16:22??ControlCAN.dll
?????文件????????3567??2019-10-29?13:39??ControlCAN.h
?????文件????????7312??2020-04-16?16:22??ControlCAN.lib
?????文件???????24484??2020-06-12?12:30??DemoCAN.aps
?????文件????????2070??2012-09-10?20:58??DemoCAN.clw
?????文件????????2079??2013-10-08?00:31??DemoCAN.cpp
?????文件????????1335??2007-12-05?20:45??DemoCAN.h
?????文件????22539264??2020-06-12?12:31??DemoCAN.ncb
?????文件???????48640??2012-09-13?20:10??DemoCAN.opt
?????文件????????1381??2012-09-13?19:57??DemoCAN.plg
?????文件????????7409??2020-06-12?10:51??DemoCAN.rc
?????文件?????????879??2013-10-08?00:29??DemoCAN.sln
?????文件????????8004??2020-06-12?10:41??DemoCAN.vcproj
?????文件????????1427??2013-10-08?00:34??DemoCAN.vcproj.6LL6R54KTRL7ZRZ.Administrator.user
?????文件????????1427??2020-06-12?12:31??DemoCAN.vcproj.DESKTOP-8K7AIEF.ttc.user
?????文件????????1417??2014-05-06?20:43??DemoCAN.vcproj.simulation.bincker-simulat.user
?????文件????????1409??2016-02-25?22:09??DemoCAN.vcproj.ttc-PC.ttc.user
?????文件???????15594??2020-06-12?12:31??DemoCANDlg.cpp
?????文件????????1811??2012-08-22?23:23??DemoCANDlg.h
?????文件????????3597??2007-12-05?20:45??ReadMe.txt
?????目錄???????????0??2020-07-16?09:34??res\
?????文件????????1078??2007-12-05?20:45??res\DemoCAN.ico
?????文件?????????399??2007-12-05?20:45??res\DemoCAN.rc2
?????文件????????2019??2012-08-22?23:23??resource.h
?????文件?????????209??2007-12-05?20:45??StdAfx.cpp
?????文件????????1054??2007-12-05?20:45??StdAfx.h
- 上一篇:MFC控件重繪
- 下一篇:打飛機小游戲57466
評論
共有 條評論