void CPropertiesWnd::OnPropDownitem()
{
	if (!IsComboType())
	{
		return;
	}

	CMFCPropertyGridProperty *pProp = m_wndPropList.GetCurSel();
	if (pProp && pProp->IsGroup())
	{
		CString strName(pProp->GetName());
		if (strName.CompareNoCase(_T("ITEM")) == 0)
		{
			CMFCPropertyGridProperty *pParentProp = pProp->GetParent();
			if (pProp == pParentProp->GetSubItem(pParentProp->GetSubItemsCount() - 1))
			{
				return;
			}

			int nEnd = 0;
			CList<CMFCPropertyGridProperty*, CMFCPropertyGridProperty*> lstSubItems;
			for (int i = pParentProp->GetSubItemsCount() - 1; i >= nEnd; i--)
			{
				CMFCPropertyGridProperty *pChildProp = pParentProp->GetSubItem(i);
				if (pChildProp)
				{
					if (pChildProp == pProp)
					{
						nEnd = i;
						lstSubItems.InsertAfter(lstSubItems.GetHeadPosition(), pChildProp);
					}
					else
					{
						lstSubItems.AddHead(pChildProp);
					}
					pParentProp->RemoveSubItem(pChildProp, FALSE);
				}
			}

			for (POSITION pos = lstSubItems.GetHeadPosition(); pos != NULL;)
			{
				CMFCPropertyGridProperty* pProp = lstSubItems.GetNext(pos);
				ASSERT_VALID(pProp);

				pParentProp->AddSubItem(pProp);
			}
			m_wndPropList.AdjustLayout();
		}
	}
}
void CPropertiesWnd::OnPropDelitem()
{
	if (!IsComboType())
	{
		return;
	}

	CMFCPropertyGridProperty *pProp = m_wndPropList.GetCurSel();
	if (pProp && pProp->IsGroup())
	{
		CString strName(pProp->GetName());
		if (strName.CompareNoCase(_T("ITEM")) == 0 && AfxMessageBox(_T("Sure to delete it?"), MB_YESNO) == IDYES)
		{
			pProp->GetParent()->RemoveSubItem(pProp);
			m_wndPropList.RedrawWindow();
		}
	}
}