Click here to Skip to main content
16,006,605 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProper use of _bstr_t Pin
nibor27-Jul-03 23:12
nibor27-Jul-03 23:12 
Questionhow to connect to dbase server using postgres Pin
mhar27-Jul-03 22:55
professionalmhar27-Jul-03 22:55 
AnswerRe: how to connect to dbase server using postgres Pin
basementman28-Jul-03 5:12
basementman28-Jul-03 5:12 
General_open routine Pin
El'Cachubrey27-Jul-03 22:38
El'Cachubrey27-Jul-03 22:38 
GeneralRe: _open routine Pin
Johnny ²28-Jul-03 3:49
Johnny ²28-Jul-03 3:49 
QuestionHow to display the item of a treectrl like this? Pin
allenhu27-Jul-03 21:41
allenhu27-Jul-03 21:41 
AnswerRe: How to display the item of a treectrl like this? Pin
Iain Clarke, Warrior Programmer27-Jul-03 23:05
Iain Clarke, Warrior Programmer27-Jul-03 23:05 
AnswerRe: How to display the item of a treectrl like this? Pin
dan o27-Jul-03 23:13
dan o27-Jul-03 23:13 
hi,

create a imagelist
.h
CImageList m_cImageList;

.cpp

populate event()

if (1) //bDoThisOnlyOnce
m_cImageList.Create(IDB_TREEVIEW, 16, 10, RGB (255, 0, 255));
//IDB_TREEVIEW resource bitmap with a the all icons

GetTreeCtrl().SetImageList(&m_cImageList, TVSIL_NORMAL);

rootitem = GetTreeCtrl().InsertItem(TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, _T("RootItem"), ILI_CLOSED_FOLDER, ILI_CLOSED_FOLDER, 0, 0, -1, TVI_ROOT, TVI_SORT );

//ILI_CLOSED_FOLDER, ILI_CLOSED_FOLDER <- item nr of imagelist

Add msg
.h
afx_msg void OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult);

.cpp
void CMyTreeView::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hItem = pNMTreeView->itemNew.hItem;
CString string;string = GetPathFromItem (hItem);

*pResult = FALSE;
int inImage, inSelectedImage;

if (pNMTreeView->action == TVE_EXPAND)
{
if (GetTreeCtrl().GetParentItem (hItem) == NULL )
{
GetTreeCtrl().GetItemImage( hItem, inImage, inSelectedImage );
if (inImage == ILI_CLOSED_FOLDER && inSelectedImage == ILI_CLOSED_FOLDER)
{
GetTreeCtrl().SetItemImage( hItem, ILI_OPEN_FOLDER, ILI_OPEN_FOLDER);
}
}
}
else
{ // pNMTreeView->action == TVE_COLLAPSE
if (GetTreeCtrl().GetParentItem (hItem) == NULL)
{
GetTreeCtrl().GetItemImage( hItem, inImage, inSelectedImage );
if (inImage == ILI_OPEN_FOLDER && inSelectedImage == ILI_OPEN_FOLDER)
{
GetTreeCtrl().SetItemImage( hItem, ILI_CLOSED_FOLDER, LI_CLOSED_FOLDER);
}
}
}

hope it helps

dan o

hope it helps
GeneralParameters for MSComm Pin
petr.me27-Jul-03 21:37
petr.me27-Jul-03 21:37 
GeneralSuche Leute zum MFC / C++ lernen Pin
schonu27-Jul-03 21:04
schonu27-Jul-03 21:04 
GeneralRe: Suche Leute zum MFC / C++ lernen Pin
Philip Patrick28-Jul-03 1:20
professionalPhilip Patrick28-Jul-03 1:20 
GeneralRe: Suche Leute zum MFC / C++ lernen Pin
peterchen28-Jul-03 4:41
peterchen28-Jul-03 4:41 
GeneralWin32 vc++ Smooth Animation Pin
koxin27-Jul-03 20:54
koxin27-Jul-03 20:54 
GeneralRe: Win32 vc++ Smooth Animation Pin
Iain Clarke, Warrior Programmer27-Jul-03 23:14
Iain Clarke, Warrior Programmer27-Jul-03 23:14 
Questionhow can i apply a macro to all project files Pin
sunil_g1727-Jul-03 20:15
sunil_g1727-Jul-03 20:15 
QuestionHow to PRINT MsWord DOC through VC++ Dlg based Prg Pin
22491727-Jul-03 20:01
22491727-Jul-03 20:01 
AnswerRe: How to PRINT MsWord DOC through VC++ Dlg based Prg Pin
wb27-Jul-03 22:41
wb27-Jul-03 22:41 
GeneralSaving graph Pin
Neha27-Jul-03 20:00
Neha27-Jul-03 20:00 
GeneralRe: Saving graph Pin
Alexander M.,28-Jul-03 3:19
Alexander M.,28-Jul-03 3:19 
QuestionHow can I clear drop list combo box? Pin
Emre Zorlu27-Jul-03 19:46
Emre Zorlu27-Jul-03 19:46 
AnswerRe: How can I clear drop list combo box? Pin
Frank K27-Jul-03 19:52
Frank K27-Jul-03 19:52 
GeneralRe: How can I clear drop list combo box? Pin
Emre Zorlu27-Jul-03 21:23
Emre Zorlu27-Jul-03 21:23 
GeneralRe: How can I clear drop list combo box? Pin
David Crow28-Jul-03 5:16
David Crow28-Jul-03 5:16 
AnswerRe: How can I clear drop list combo box? Pin
wb27-Jul-03 22:42
wb27-Jul-03 22:42 
Generalweb cam Pin
Anonymous27-Jul-03 18:07
Anonymous27-Jul-03 18:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.