title: How to make CTreeCtrl::Expand not change the item positions?
body: <p>We know that the TVS_HASBUTTONS style of CTreeCtrl can display "+" or "-" before items. I want to set two icons (one for closed, one for opened) instead of the default "+" and "-", so I didn't use the TVS_HASBUTTONS style. In order to implement the function of "+" and "-", I have overrided the left mouse down handler for the icon click event, and invoked CTreeCtrl::Expand inside. But I found that the Expand method will change the item positions in the CTreeCtrl, however, "+" and "-" does not. Any solutions?</p>
  
  <pre><code>void CMyTreeCtrl::OnLButtonDown(UINT nFlags, CPoint point)
  {
      // TODO: Add your message handler code here and/or call default
      UINT uFlags;
      HTREEITEM hItem = HitTest(point, &amp;uFlags); 
      CRect Rect,IconRect;
  
      if (hItem != NULL)
      {
          if (GetItemRect(hItem,&amp;Rect,TRUE))
          {
              IconRect.left = Rect.left - 16;
              IconRect.right = Rect.left;
              IconRect.top   = Rect.top;
              IconRect.bottom = Rect.bottom;
  
              if (IconRect.PtInRect(point))
              {
                  Expand(hItem, TVE_TOGGLE);
              }
              else
              {
                  //MyMessageBox_Error(_T("not icon"));
              }
          }
      }
  
      CTreeCtrlDrag::OnLButtonDown(nFlags, point);
  }
  </code></pre>