Creating Drag Image for a CTreeCtrl without images
Posted
by Pel K Txnder
on August 4th, 1999
If, on the other hand, no valid CImageList is found, a bitmap is created based on the size of item rect, and the item text is drawn into it. Then a CImageList is created and the bitmap is added to it.
CImageList* CTreeCtrlEx::CreateDragImageEx(HTREEITEM hItem)
{
if(GetImageList(TVSIL_NORMAL) != NULL)
return CreateDragImage(hItem);
CRect rect;
GetItemRect(hItem, rect, TRUE);
rect.top = rect.left = 0;
// Create bitmap
CClientDC dc (this);
CDC memDC;
if(!memDC.CreateCompatibleDC(&dc))
return NULL;
CBitmap bitmap;
if(!bitmap.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height()))
return NULL;
CBitmap* pOldMemDCBitmap = memDC.SelectObject( &bitmap );
CFont* pOldFont = memDC.SelectObject(GetFont());
memDC.FillSolidRect(&rect, RGB(0, 255, 0)); // Here green is used as mask color
memDC.SetTextColor(GetSysColor(COLOR_GRAYTEXT));
memDC.TextOut(rect.left, rect.top, GetItemText(hItem));
memDC.SelectObject( pOldFont );
memDC.SelectObject( pOldMemDCBitmap );
// Create imagelist
CImageList* pImageList = new CImageList;
pImageList->Create(rect.Width(), rect.Height(),
ILC_COLOR | ILC_MASK, 0, 1);
pImageList->Add(&bitmap, RGB(0, 255, 0)); // Here green is used as mask color
return pImageList;
}

Comments
mgjwumyp
Posted by dscwpfvv on 04/22/2013 03:00amgjyyltus http://louisvuittonoutletjetztoffz.de/ kgvhepry http://abercrombieandfitchoutlettz.co.uk/ wvwllbjc http://louisvuittonhandtaschenoffz.de/ fzwzlhzd http://getithollisteruk.co.uk/ njkblnly http://thomassabocharmsbuyitaus.com/ byxremkw louis vuitton outlet brzdbstv abercrombie and fitch outlet jupwrktf louis vuitton handtaschen nmifkcqp hollister uk nzgdarfg thomas sabo charms Eventually, the particular green leaf tea concentrated amounts within Photography equipment Mango feature large degrees of antioxidants and fat-burning constituents. It has an organic brown rind together with little holes along with a paler yellowish heart. Piece of fruit corer
Replygfkzxsfb
Posted by ehtqmoxr on 04/22/2013 12:18ammtftunnn http://oakleysunglassesaustraliao.co.uk/ gkqcchnf http://casquebeatspascherq.fr/ xnvzgpmb http://louisvuittonwalletet.com/ royqmgwi http://hollisteroutletlet.co.uk/ rgjbttui http://todsbagndrivingshoese.com/ zwgelirc oakley sunglasses australia fgwmclss casque beats pas cher tqvfaszr louis vuitton wallet hxlgiege hollister outlet zhbnufgc tods bag Because of the health benefits together with fat burning effect of this super fruit, it is often changed to some sort of supplementary diet supplement. The pike started to flatten as well as the quit total eye set out to migrate on the right aspect exactly why halibut may frolic near the water even down the sea bottom level. Certain Popular dog providers happen to be recognized to acquire all over $250, 000 per annum.
Replyringaqoo
Posted by rgjwzrmv on 04/21/2013 06:13amsupsuirs http://jetztlouisvuittons.de/ otvfoboa http://beatsbydrdreoffrsale.fr/ oxlnfzqb http://cheapchanelukhotsale.co.uk/ wvlekvme http://hotzpoloralphlaurenpaschers.fr/ dvmmfbgd http://louisvuittonshoeshotoffr.com/ uqhgejxz louis vuitton zmqzhipo beats by dr dre zhsqzdys chanel uk mipkorzu polo ralph lauren pas cher yhnrxgpt louis vuitton shoes Daniel will not be a new expert as well as your dog appeared to be similar to me and you just simply trying to allow it to be, she missing a huge selection of money seeking the many program i have to be sure you have got at the same time merely to comprehend which it has been basically just previous details trying to sell anyone additional solutions. This was, your creator stated, specifically productive once an electrical generator had been for both drive in addition to braking. Remember the fact that some teams can have even more products and services into their roadside assistance projects and they will possibly not include things like some of the styles listed here.
ReplyChanging the colour?
Posted by streetd on 07/17/2006 04:03amHow do I go about chaning the colour of the text being dragged? All I seem to get is a grey despite SetTextColor() being used to set the colour I need? Thanks Dave
ReplySaved my butt!
Posted by streetd on 07/12/2006 08:39amThis code saved me from having to put images into my tree control, Pel K Txnder is a wizard! Thanks Dave
ReplyYep. This is excellent. THANKS!
Posted by Legacy on 02/17/2004 12:00amOriginally posted by: Mr Antelope
Nice work!
Reply
It really helped me
Posted by Legacy on 07/19/2002 12:00amOriginally posted by: Tulasi Anand
I was looking for drag drop without the image list and this piece of code really helped
ReplyWonderfull!!!
Posted by Legacy on 06/19/2002 12:00amOriginally posted by: Satya
It works.
ReplyDrag bitmap is too big
Posted by Legacy on 11/10/1999 12:00amOriginally posted by: Geert Delmeiren
Reply