Skip to main content

Featured

Build docker image from multiple build contexts

Build docker image from multiple build contexts Building a docker image requires specifying a source of truth to include in the image from a local directory or a remote git repository. In the previous version, the docker BuildKit allows users to specify the build context from a single source of truth only. However, the engineers may need to have the context from different locations based on the type of files. For instance, icons, images or other resources that are not included in the same package, including the resource from other docker images. Fortunately, the Docker Buildx toolkit supports multiple build context flag for Docker 1.4. Let's learn how to use this new feature. The following list is a shortcut for jumping into a specific topic handy. What version of Docker is this tutorial targeting? How to specify the version of Dockerfile frontend? Ho

[CListCtrl]改變儲存格文字顏色

資料也是在網路上找來的,只是急著測試,就沒有記住來源了。所以一定會有雷同,找時間在把內容整理過嚕@@

需要用到NM_CUSTOMDRAW訊息,這要放在Dialog的message map內:
ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST, &CXListCtrl::OnNMCustomdrawLst)

因此要改寫CListCtrl::OnNMCustomdrawLst()
 void CXListCtrl::OnNMCustomdrawLst(NMHDR *pNMHDR, LRESULT *pResult)  
{  
LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);  
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);  
// TODO: Add your control notification handler code here  
*pResult = 0;  
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )  
{  
*pResult = CDRF_NOTIFYITEMDRAW;  
}else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage ) {  
//  // This is the prepaint stage for an item. Here's where we set the  
//  // item's text color. Our return value will tell Windows to draw the  
//  // item itself, but it will use the new color we set here.  
//  // We'll cycle the colors through red, green, and light blue.  
*pResult = CDRF_NOTIFYSUBITEMDRAW;        //To Draw sub item request  
} else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage ) {  
// This is the prepaint stage for a subitem. Here's where we set the  
// item's text and background colors. Our return value will tell   
// Windows to draw the subitem itself, but it will use the new colors  
// we set here.  
// The text color will cycle through red, green, and light blue.  
// The background color will be light blue for column 0, red for  
// column 1, and black for column 2.  
COLORREF crText, crBkgnd;  
//                Sub Item Index                                    Item Index  
if ( (3 == pLVCD->iSubItem && pLVCD->nmcd.dwItemSpec == 1) ||  
(3 == pLVCD->iSubItem && pLVCD->nmcd.dwItemSpec == 3) )  
{  
crText = RGB(255,0,0);  
//crBkgnd = RGB(128,128,255);  
}  
else if ( 1 == pLVCD->iSubItem )  
{  
crText = RGB(0,255,0);  
crBkgnd = RGB(255,0,0);  
}  
else  
{  
crText = RGB(128,128,255);  
crBkgnd = RGB(0,0,0);  
}  
// Store the colors back in the NMLVCUSTOMDRAW struct.  
pLVCD->clrText = crText;  
//pLVCD->clrTextBk = crBkgnd; 
// Tell Windows to paint the control itself.  
//*pResult = CDRF_DODEFAULT;  
*pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYSUBITEMDRAW;  
}  
}  

Comments

Popular Posts