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

[CTreeCtrl]在Tree Item前顯示載入的BMP圖片

1.使用LoadImage()載入BMP檔。
2.使用CBitMap::Attach()載入HBITMAP。
3.將產生的CBitMap物件透過CImageList::Add()設定給CImageList。
4.使用CTreeCtrl::SetImageList()將CImageList設定給CTreeCtrl。
5.在需要塞入圖片的Item使用SetItemImage()指定圖片即可。
6.由於這邊使用LoadImage()時,是讀新的圖片進來,所以不用到圖片時,則需在使用DeleteObject()來釋放記憶體。

 HBITMAP hBMP= (HBITMAP)LoadImage(NULL,"c:\\temp\\noname.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);  
 if ( !hBMP ) {  
     CDSMsgShower::ShowMsgByErrorBox(this->m_hWnd, "ERROR", MB_OK, "Fail to load bmp file. Error =%d", ::GetLastError());  
 }  

 CBitmap *pBMP = new CBitmap;  
 pBMP->Attach(hBMP);  
   
 if (!m_cImageList.Create(16,16, ILC_COLOR16|ILC_MASK, 6, 6))  
     AfxMessageBox("Problem in creating ImageList");  
 this->m_cImageList.Add(pBMP, RGB(255, 255, 255));  //Mask部分如沒有其他顏色要過濾掉的話,就設成白色

Comments

Popular Posts