1。VS 编译器 属性设置控件的实现。
完整工程下载地址:
#include "StdAfx.h"
#include "UIProperties.h"
//
//CMFCPropertyGridColor32Property
CMFCPropertyGridColor32Property::CMFCPropertyGridColor32Property(const CString& strName, const COLORREF& color,CPalette* pPalette/*=NULL*/,LPCTSTR lpszDescr/*=NULL*/,DWORD_PTR dwData/*=0*/)
:CMFCPropertyGridColorProperty(strName,color,pPalette,lpszDescr,dwData)
{
}
BOOL CMFCPropertyGridColor32Property::OnUpdateValue()
{
ASSERT_VALID(this);
if (m_pWndInPlace == NULL)
{
return FALSE;
}
ASSERT_VALID(m_pWndInPlace);
ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd()));
CString strText;
m_pWndInPlace->GetWindowText(strText);
COLORREF colorCurr = m_Color;
int nA = 0,nR = 0, nG = 0, nB = 0;
_stscanf_s(strText, _T("%2x%2x%2x%2x"), &nA, &nR, &nG, &nB);
if(nA == 0 && (nR !=0 || nG != 0 || nB != 0))
nA = 0xFF;
m_Color = ARGB(nA, nR, nG, nB);
if (colorCurr != m_Color)
{
m_pWndList->OnPropertyChanged(this);
}
return TRUE;
}
void CMFCPropertyGridColor32Property::OnDrawValue(CDC* pDC, CRect rect)
{
CRect rectColor = rect;
rect.left += rect.Height();
CMFCPropertyGridProperty::OnDrawValue(pDC, rect);
rectColor.right = rectColor.left + rectColor.Height();
rectColor.DeflateRect(1, 1);
rectColor.top++;
rectColor.left++;
CBrush br(m_Color == (COLORREF)-1 ? m_ColorAutomatic : (m_Color&0x00FFFFFF));
pDC->FillRect(rectColor, &br);
pDC->Draw3dRect(rectColor, 0, 0);
}
CString CMFCPropertyGridColor32Property::FormatProperty()
{
ASSERT_VALID(this);
CString str;
str.Format(_T("%02x%02x%02x%02x"),GetAValue(m_Color),GetRValue(m_Color),GetGValue(m_Color),GetBValue(m_Color));
return str;
}
//
//CMFCPropertyGridImageProperty
IMPLEMENT_DYNAMIC(CMFCPropertyGridImageProperty, CMFCPropertyGridProperty)
CMFCPropertyGridImageProperty::CMFCPropertyGridImageProperty(const CString& strName, const CString& strImage, LPCTSTR lpszDescr/* = NULL*/, DWORD_PTR dwData/* = 0*/)
: CMFCPropertyGridProperty(strName, COleVariant((LPCTSTR)strImage), lpszDescr, dwData)
{
m_dwFlags = AFX_PROP_HAS_BUTTON;
}
void CMFCPropertyGridImageProperty::OnClickButton(CPoint point)
{
ASSERT_VALID(this);
ASSERT_VALID(m_pWndList);
ASSERT_VALID(m_pWndInPlace);
ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd()));
m_bButtonIsDown = TRUE;
Redraw();
//CString strImage = m_varValue.bstrVal;
//CImageDialog dlg(strImage);
//if(dlg.DoModal()==IDOK)
//{
// strImage=dlg.GetImage();
//}
//if (m_pWndInPlace != NULL)
//{
// m_pWndInPlace->SetWindowText(strImage);
//}
//m_varValue = (LPCTSTR) strImage;
//m_bButtonIsDown = FALSE;
//Redraw();
//if (m_pWndInPlace != NULL)
//{
// m_pWndInPlace->SetFocus();
//}
//else
//{
// m_pWndList->SetFocus();
//}
}
//
//CMFCPropertyGridCustomFontsProperty
IMPLEMENT_DYNAMIC(CMFCPropertyGridCustomFontsProperty, CMFCPropertyGridProperty)
CMFCPropertyGridCustomFontsProperty::CMFCPropertyGridCustomFontsProperty(const CString& strName, const COleVariant& varValue, LPCTSTR lpszDescr/* = NULL*/, DWORD_PTR dwData/* = 0*/)
: CMFCPropertyGridProperty(strName, varValue, lpszDescr, dwData)
{
m_dwFlags = AFX_PROP_HAS_BUTTON;
}
void CMFCPropertyGridCustomFontsProperty::OnClickButton(CPoint point)
{
ASSERT_VALID(this);
ASSERT_VALID(m_pWndList);
ASSERT_VALID(m_pWndInPlace);
ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd()));
m_bButtonIsDown = TRUE;
Redraw();
/*CDialogCustomFonts dlg;
dlg.DoModal();
m_bButtonIsDown = FALSE;
Redraw();
if (m_pWndInPlace != NULL)
{
m_pWndInPlace->SetFocus();
}
else
{
m_pWndList->SetFocus();
}*/
}
//
//CMFCPropertyGridDefaultAttribListProperty
IMPLEMENT_DYNAMIC(CMFCPropertyGridDefaultAttribListProperty, CMFCPropertyGridProperty)
CMFCPropertyGridDefaultAttribListProperty::CMFCPropertyGridDefaultAttribListProperty(const CString& strName, const COleVariant& varValue, LPCTSTR lpszDescr/* = NULL*/, DWORD_PTR dwData/* = 0*/)
: CMFCPropertyGridProperty(strName, varValue, lpszDescr, dwData)
{
m_dwFlags = AFX_PROP_HAS_BUTTON;
}
void CMFCPropertyGridDefaultAttribListProperty::OnClickButton(CPoint point)
{
ASSERT_VALID(this);
ASSERT_VALID(m_pWndList);
ASSERT_VALID(m_pWndInPlace);
ASSERT(::IsWindow(m_pWndInPlace->GetSafeHwnd()));
m_bButtonIsDown = TRUE;
Redraw();
/*CDialogDefaultAttribList dlg;
dlg.DoModal();
m_bButtonIsDown = FALSE;
Redraw();
if (m_pWndInPlace != NULL)
{
m_pWndInPlace->SetFocus();
}
else
{
m_pWndList->SetFocus();
}*/
}
//
//CUIProperties
UINT WM_UI_PROPERTY_CHANGED = ::RegisterWindowMessage(_T("WM_UI_PROPERTY_CHANGED"));
IMPLEMENT_DYNAMIC(CUIProperties, CWnd)
CUIProperties::CUIProperties(void)
{
}
CUIProperties::~CUIProperties(void)
{
}
BEGIN_MESSAGE_MAP(CUIProperties, CWnd)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_SIZE()
ON_REGISTERED_MESSAGE(AFX_WM_PROPERTY_CHANGED, OnPropertyChanged)
//ON_COMMAND(ID_PROPERTIES_TOOLBAR_SORT, OnPropertiesSort)
//ON_UPDATE_COMMAND_UI(ID_PROPERTIES_TOOLBAR_SORT, OnUpdatePropertiesSort)
//ON_COMMAND(ID_PROPERTIES_TOOLBAR_ALPHABETIC, OnPropertiesAlphaBetic)
//ON_UPDATE_COMMAND_UI(ID_PROPERTIES_TOOLBAR_ALPHABETIC, OnUpdatePropertiesAlphaBetic)
END_MESSAGE_MAP()
BOOL CUIProperties::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
{
return CWnd::Create(afxGlobalData.RegisterWindowClass(_T("UIPropWnd")), _T(""), dwStyle, rect, pParentWnd, nID, NULL);
}
int CUIProperties::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CRect rectDummy;
rectDummy.SetRectEmpty();
// 创建组合:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
if(!m_wndPropList.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, 2))
{
TRACE0("未能创建属性网格\n");
return -1; // 未能创建
}
InitPropList();
m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_TOOLBAR3);
m_wndToolBar.LoadToolBar(IDR_TOOLBAR3, 0, 0, TRUE /* 已锁定*/);
m_wndToolBar.CleanUpLockedImages();
m_wndToolBar.LoadBitmap(IDB_BITMAP2, 0, 0, TRUE /* 锁定*/);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
m_wndToolBar.SetOwner(this);
// 所有命令将通过此控件路由,而不是通过主框架路由:
m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
AdjustLayout();
return 0;
}
void CUIProperties::AdjustLayout()
{
if(GetSafeHwnd() == NULL)
return;
CRect rectClient;
GetClientRect(rectClient);
int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy;
m_wndToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);
m_wndPropList.SetWindowPos(NULL, rectClient.left, rectClient.top + cyTlb, rectClient.Width(), rectClient.Height() -cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);
}
void CUIProperties::SetVSDotNetLook(BOOL bSet)
{
m_wndPropList.SetVSDotNetLook(bSet);
m_wndPropList.SetGroupNameFullWidth(bSet);
}
void CUIProperties::OnSetFocus(CWnd* pOldWnd)
{
CWnd::OnSetFocus(pOldWnd);
// TODO: Add your message handler code here
m_wndPropList.SetFocus();
}
void CUIProperties::OnSize(UINT nType, int cx, int cy)
{
CWnd::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
AdjustLayout();
}
LRESULT CUIProperties::OnPropertyChanged(WPARAM wp, LPARAM lp)
{
CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty *)lp;
int nLevel = pProp->GetHierarchyLevel();
for(; nLevel>1; nLevel--)
pProp = pProp->GetParent();
GetOwner()->SendMessage(WM_UI_PROPERTY_CHANGED, wp, LPARAM(pProp));
return TRUE;
}
void CUIProperties::OnPropertiesSort()
{
m_wndPropList.SetAlphabeticMode(FALSE);
}
void CUIProperties::OnUpdatePropertiesSort(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(!m_wndPropList.IsAlphabeticMode());
}
void CUIProperties::OnPropertiesAlphaBetic()
{
m_wndPropList.SetAlphabeticMode(TRUE);
}
void CUIProperties::OnUpdatePropertiesAlphaBetic(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_wndPropList.IsAlphabeticMode());
}
void CUIProperties::InitPropList()
{
SetPropListFont();
m_wndPropList.EnableHeaderCtrl(FALSE);
m_wndPropList.EnableDescriptionArea();
m_wndPropList.SetVSDotNetLook();
CMFCPropertyGridProperty* pPropUI=NULL;
CMFCPropertyGridProperty* pValueList=NULL;
CMFCPropertyGridProperty* pProp=NULL;
CMFCPropertyGridColorProperty* pPropColor=NULL;
CMFCPropertyGridImageProperty* pPropImage=NULL;
//Window
#pragma region Window
pPropUI=new CMFCPropertyGridProperty(_T("Window"),classWindow);
pValueList=new CMFCPropertyGridProperty(_T("Size"),tagWindowSize,TRUE);//size
pProp=new CMFCPropertyGridProperty(_T("Width"),(_variant_t)(LONG)0,_T("窗体的宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Height"),(_variant_t)(LONG)0,_T("窗体的高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("Caption"),tagCaption,TRUE);//caption
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("标题的Left位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("标题的Top位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("标题的Right位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("标题的Bottom位置"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("SizeBox"),tagSizeBox,TRUE);//sizebox
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("尺寸盒的Left位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("尺寸盒的Top位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("尺寸盒的Right位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("尺寸盒的Bottom位置"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("RoundCorner"),tagRoundCorner,TRUE);//roundcorner
pProp=new CMFCPropertyGridProperty(_T("Width"),(_variant_t)(LONG)0,_T("圆角的宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Height"),(_variant_t)(LONG)0,_T("圆角的高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("MinInfo"),tagMinInfo,TRUE);//mininfo
pProp=new CMFCPropertyGridProperty(_T("MinWidth"),(_variant_t)(LONG)0,_T("窗口的最小跟踪宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("MinHeight"),(_variant_t)(LONG)0,_T("窗口的最小跟踪高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("MaxInfo"),tagMinInfo,TRUE);//maxinfo
pProp=new CMFCPropertyGridProperty(_T("MaxWidth"),(_variant_t)(LONG)0,_T("窗口的最大跟踪宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Maxeight"),(_variant_t)(LONG)0,_T("窗口的最大跟踪高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pProp=new CMFCPropertyGridProperty(_T("ShowDirty"),(_variant_t)false,_T("指示是否显示更新区域"),tagShowDirty);//showdirty
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridCustomFontsProperty(_T("CustomFonts"),(_variant_t)_T("字体管理"),_T("管理自定义的字体"),tagCustomFonts);//customfonts
pProp->AllowEdit(FALSE);
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridDefaultAttribListProperty(_T("DefaultAttribList"),(_variant_t)_T("默认属性列表管理"),_T("管理默认的属性列表"),tagDefaultAttribList);//defaultattriblist
pProp->AllowEdit(FALSE);
pPropUI->AddSubItem(pProp);
// tagAlpha
pProp=new CMFCPropertyGridProperty(_T("Alpha"),(_variant_t)(LONG)0,_T("窗口的alpha值(0-255)\n255"),tagAlpha);
pPropUI->AddSubItem(pProp);
// tagBkTrans
pProp=new CMFCPropertyGridProperty(_T("BkTrans"),(_variant_t)false,_T("窗口是否使用静态透明背景\nfalse"),tagBkTrans);
pPropUI->AddSubItem(pProp);
// tagDefaultFontColor
pPropColor=new CMFCPropertyGridColor32Property(_T("DefaultFontColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定默认的字体颜色"),tagDefaultFontColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
// tagSelectedFontColor
pPropColor=new CMFCPropertyGridColor32Property(_T("SelectedColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定默认的selected字体颜色"),tagSelectedFontColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
// DisabledFontColor
pPropColor=new CMFCPropertyGridColor32Property(_T("DisabledFontColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定默认的Disabled字体颜色"),tagDisabledFontColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
// tagLinkFontColor
pPropColor=new CMFCPropertyGridColor32Property(_T("LinkFontColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定默认的link字体颜色"),tagLinkFontColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
// tagLinkHoverFontColor
pPropColor=new CMFCPropertyGridColor32Property(_T("LinkHoverFontColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定默认的linkhoverfont字体颜色"),tagLinkHoverFontColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Window
//Control
#pragma region Control
pPropUI=new CMFCPropertyGridProperty(_T("Control"),classControl);
pProp=new CMFCPropertyGridProperty(_T("Name"),(_variant_t)_T(""),_T("控件的名称"),tagName);//name
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Text"),(_variant_t)_T(""),_T("控件的显示文本"),tagText);//text
pPropUI->AddSubItem(pProp);
pValueList=new CMFCPropertyGridProperty(_T("Pos"),tagPos,TRUE);//pos
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("控件的Left位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("控件的Top位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("控件的Right位置"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("控件的Bottom位置"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("RelativePos"),tagRelativePos,TRUE);//relativepos
pProp=new CMFCPropertyGridProperty(_T("MoveX"),(_variant_t)(LONG)0,_T("控件的水平位移"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("MoveY"),(_variant_t)(LONG)0,_T("控件的垂直位移"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("ZoomX"),(_variant_t)(LONG)0,_T("控件的水平比例"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("ZoomY"),(_variant_t)(LONG)0,_T("控件的垂直比例"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("Size"),tagSize,TRUE);//size
pProp=new CMFCPropertyGridProperty(_T("Width"),(_variant_t)(LONG)0,_T("控件的宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Height"),(_variant_t)(LONG)0,_T("控件的高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("MinSize"),tagMinSize,TRUE);//minsize
pProp=new CMFCPropertyGridProperty(_T("MinWidth"),(_variant_t)(LONG)0,_T("指定控件的最小宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("MinHeight"),(_variant_t)(LONG)0,_T("指定控件的最小高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("MaxSize"),tagMaxSize,TRUE);
pProp=new CMFCPropertyGridProperty(_T("MaxWidth"),(_variant_t)(LONG)0,_T("指定控件的最大宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("MaxHeight"),(_variant_t)(LONG)0,_T("指定控件的最大高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("Padding"),tagPadding,TRUE);//padding
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("指定控件内部的左边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("指定控件内部的上边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("指定控件内部的右边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("指定控件内部的下边距"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pPropImage=new CMFCPropertyGridImageProperty(_T("BkImage"),_T(""),_T("指定控件的背景图片"),tagBkImage);//bkimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropColor=new CMFCPropertyGridColor32Property(_T("BkColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定控件的背景颜色"),tagBkColor);//bkcolor
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
pPropColor=new CMFCPropertyGridColorProperty(_T("BkColor2"),(LONG)RGB(0,0,0),NULL,_T("指定控件的背景颜色2"),tagBkColor2);//bkcolor2
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
pPropColor=new CMFCPropertyGridColorProperty(_T("BorderColor"),(LONG)RGB(0,0,0),NULL,_T("指定控件的边框颜色"),tagBorderColor);//bordercolor
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//focusbordercolor
pPropColor=new CMFCPropertyGridColorProperty(_T("focusbordercolor"),(LONG)RGB(0,0,0),NULL,_T("指定控件边框获得焦点时边框的颜色"),tagFocusBorderColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
pProp=new CMFCPropertyGridProperty(_T("BorderSize"),(_variant_t)(LONG)0,_T("指定控件的边框线宽\n1"),tagBorderSize);//bordersize
pPropUI->AddSubItem(pProp);
//borderround
pValueList=new CMFCPropertyGridProperty(_T("borderround"),tagBorderRound,TRUE);
pProp=new CMFCPropertyGridProperty(_T("Width"),(_variant_t)(LONG)0,_T("边框圆角的宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Height"),(_variant_t)(LONG)0,_T("边框圆角的高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pProp=new CMFCPropertyGridProperty(_T("Enabled"),(_variant_t)true,_T("指示是否已启用该控件\nTrue"),tagEnabled);//enabled
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Float"),(_variant_t)false,_T("确定该控件是固定的,还是浮动的\nFalse"),tagFloat);//float
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Visible"),(_variant_t)true,_T("确定该控件是可见的,还是隐藏的\nTrue"),tagVisible);//visible
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Mouse"),(_variant_t)true,_T("指示该控件是否响应鼠标操作\nTrue"),tagMouse);//mouse
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Menu"),(_variant_t)false,_T("指示该控件是否需要右键菜单\nFalse"),tagMenu);//menu
pPropUI->AddSubItem(pProp);
//colorhsl
pProp=new CMFCPropertyGridProperty(_T("ColorHSL"),(_variant_t)false,_T("指示该控件的颜色是否随窗口的hsl变化而变化\nFalse"),tagColorHSL);
pPropUI->AddSubItem(pProp);
//tooltip
pProp=new CMFCPropertyGridProperty(_T("Tooltip"),(_variant_t)_T(""),_T("指示该控件鼠标悬浮提示"),tagTooltip);
pPropUI->AddSubItem(pProp);
//userdata
pProp=new CMFCPropertyGridProperty(_T("UserData"),(_variant_t)_T(""),_T("指示该控件自定义标识\nFalse"),tagUserData);
pPropUI->AddSubItem(pProp);
//keyboard
pProp=new CMFCPropertyGridProperty(_T("KeyBoard"),(_variant_t)false,_T("指示CButton类控件是否接受TabStop和按键事件\nFalse"),tagKeyBoard);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Control
//Label
#pragma region Label
pPropUI=new CMFCPropertyGridProperty(_T("Label"),classLabel);
//align
pProp=new CMFCPropertyGridProperty(_T("Align"),_T("Center"),_T("指示文本的对齐方式"),tagAlign);
pProp->AddOption(_T("Center"));
pProp->AddOption(_T("Left"));
pProp->AddOption(_T("Right"));
pProp->AddOption(_T("Top"));
pProp->AddOption(_T("Bottom"));
pProp->AllowEdit(FALSE);
pPropUI->AddSubItem(pProp);
//textcolor
pPropColor=new CMFCPropertyGridColorProperty(_T("TextColor"),(LONG)RGB(0,0,0),NULL,_T("指定文本的颜色"),tagTextColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//disabledtextcolor
pPropColor=new CMFCPropertyGridColorProperty(_T("DisabledTextColor"),(LONG)RGB(0,0,0),NULL,_T("指定文本的颜色"),tagDisabledTextColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//font
pProp=new CMFCPropertyGridProperty(_T("Font"),(_variant_t)(LONG)-1,_T("指定文本的字体"),tagFont);
pPropUI->AddSubItem(pProp);
//textpadding
pValueList=new CMFCPropertyGridProperty(_T("TextPadding"),tagTextPadding,TRUE);
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("指定文本区域的左边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("指定文本区域的上边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("指定文本区域的右边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("指定文本区域的下边距"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
//showhtml
pProp=new CMFCPropertyGridProperty(_T("ShowHtml"),(_variant_t)false,_T("指示是否使用HTML格式的文本"),tagShowHtml);
pPropUI->AddSubItem(pProp);
//endellipsis
pProp=new CMFCPropertyGridProperty(_T("EndEllipsis"),(_variant_t)false,_T("指示句末显示不全是否使用...代替"),tagEndEllipsis);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Label
//Button
#pragma region Button
pPropUI=new CMFCPropertyGridProperty(_T("Button"),classButton);
pPropImage=new CMFCPropertyGridImageProperty(_T("NormalImage"),_T(""),_T("指定按钮正常显示时的图片"),tagNormalImage);//normalimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("HotImage"),_T(""),_T("指定按钮获得热点时的图片"),tagHotImage);//hotimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("PushedImage"),_T(""),_T("指定按钮被按压下时的图片"),tagPushedImage);//pushedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("FocusedImage"),_T(""),_T("指定按钮获得焦点后的图片"),tagFocusedImage);//focusedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("DisabledImage"),_T(""),_T("指定按钮被禁用后的图片"),tagDisabledImage);//disabledimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Button
//Edit
#pragma region Edit
pPropUI=new CMFCPropertyGridProperty(_T("Edit"),classEdit);
//normalimage
pPropImage=new CMFCPropertyGridImageProperty(_T("NormalImage"),_T(""),_T("指定编辑框正常显示时的图片"),tagEditNormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
//hotimage
pPropImage=new CMFCPropertyGridImageProperty(_T("HotImage"),_T(""),_T("指定编辑框获得热点时的图片"),tagEditHotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
//focusedimage
pPropImage=new CMFCPropertyGridImageProperty(_T("FocusedImage"),_T(""),_T("指定编辑框获得焦点后的图片"),tagEditFocusedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
//disabledimage
pPropImage=new CMFCPropertyGridImageProperty(_T("DisabledImage"),_T(""),_T("指定编辑框被禁用后的图片"),tagEditDisabledImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
//readonly
pProp=new CMFCPropertyGridProperty(_T("ReadOnly"),(_variant_t)false,_T("指示是否只读"),tagReadOnly);
pPropUI->AddSubItem(pProp);
//password
pProp=new CMFCPropertyGridProperty(_T("Password"),(_variant_t)false,_T("指示是否使用密码框"),tagPassword);
pPropUI->AddSubItem(pProp);
//maxchar
pProp=new CMFCPropertyGridProperty(_T("MaxChar"),(_variant_t)(LONG)0,_T("指示输入字符最大长度\n255"),tagMaxChar);
pPropUI->AddSubItem(pProp);
//nativebkcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("NativeBKColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定Windows原生Edit控件的背景颜色"),tagNativeBKColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Edit
//Option
#pragma region Option
pPropUI=new CMFCPropertyGridProperty(_T("Option"),classOption);
pPropImage=new CMFCPropertyGridImageProperty(_T("ForeImage"),_T(""),_T("指定复选框的前景图片"),tagOptForeImage);//foreimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("SelectedImage"),_T(""),_T("指定复选框被选择后的图片"),tagSelectedImage);//selectedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pProp=new CMFCPropertyGridProperty(_T("Selected"),(_variant_t)false,_T("指示是否已被选中"),tagSelected);//selected
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Group"),(_variant_t)_T(""),_T("指定参与组合的名称"),tagGroup);//group
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Option
//Progress
#pragma region Progress
pPropUI=new CMFCPropertyGridProperty(_T("Progress"),classProgress);
pPropImage=new CMFCPropertyGridImageProperty(_T("ForeImage"),_T(""),_T("指定进度条的前景图片"),tagForeImage);//foreimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pValueList=new CMFCPropertyGridProperty(_T("MinMax"),tagMinMax,TRUE);//minmax
pProp=new CMFCPropertyGridProperty(_T("Min"),(_variant_t)(LONG)0,_T("指定进度条的最小值"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Max"),(_variant_t)(LONG)0,_T("指定进度条的最大值"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pProp=new CMFCPropertyGridProperty(_T("Value"),(_variant_t)(LONG)0,_T("指定进度条的值"),tagValue);//value
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Hor"),(_variant_t)false,_T("指示进度条是否水平"),tagHor);//hor
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("IsStretchFore"),(_variant_t)false,_T("指定前景是否缩放"),tagIsStretchFore);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Progress
//Slider
#pragma region Slider
pPropUI=new CMFCPropertyGridProperty(_T("Slider"),classSlider);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbImage"),_T(""),_T("指定滑块的滑条图片"),tagThumbImage);//thumbimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbHotImage"),_T(""),_T("指定滑条获得热点时的图片"),tagThumbHotImage);//thumbhotimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbPushedImage"),_T(""),_T("指定滑条被按压后的图片"),tagThumbPushedImage);//thumbpushedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pValueList=new CMFCPropertyGridProperty(_T("ThumbSize"),tagThumbSize,TRUE);//thumbsize
pProp=new CMFCPropertyGridProperty(_T("Width"),(_variant_t)(LONG)0,_T("指定滑条的宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Height"),(_variant_t)(LONG)0,_T("指定滑条的高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Slider
//ActiveX
#pragma region ActiveX
pPropUI=new CMFCPropertyGridProperty(_T("ActiveX"),classActiveX);
//clsid
pProp=new CMFCPropertyGridProperty(_T("Clsid"),(_variant_t)_T(""),_T("指定ActiveX控件的Clsid值"),tagClsid);
pPropUI->AddSubItem(pProp);
//delaycreate
pProp=new CMFCPropertyGridProperty(_T("DelayCreate"),(_variant_t)true,_T("指示是否延迟加载ActiveX控件"),tagDelayCreate);
pPropUI->AddSubItem(pProp);//added by 邓景仁 2011-09-08
// modulename
pProp=new CMFCPropertyGridProperty(_T("ModuleName"),(_variant_t)_T(""),_T("指示从指定位置加载ActiveX控件\n如(flash/flash.ocx)"),tagModuleName);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion ActiveX
//Container
#pragma region Container
pPropUI=new CMFCPropertyGridProperty(_T("Container"),classContainer);
pValueList=new CMFCPropertyGridProperty(_T("Inset"),tagInset,TRUE);//inset
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("指定容器客户区域的左边距\n0"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("指定容器客户区域的上边距\n0"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("指定容器客户区域的右边距\n0"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("指定容器客户区域的下边距\n0"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pProp=new CMFCPropertyGridProperty(_T("ChildPadding"),(_variant_t)(LONG)0,_T("指定子控件之间的间距\n0"),tagChildPadding);//childpadding
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("MouseChild"),(_variant_t)false,_T("指定本控件的子控件是否可以响应用户操作\nTrue"),tagMouseChild);//mousechild
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("HScrollBar"),(_variant_t)false,_T("指示是否启用水平滚动条\nFalse"),tagHScrollBar);//hscrollbar
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("VScrollBar"),(_variant_t)false,_T("指示是否启用垂直滚动条\nFalse"),tagVScrollBar);//vscrollbar
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Container
//Item
#pragma region Item
pPropUI=new CMFCPropertyGridProperty(_T("Item"),classItem);
pPropImage=new CMFCPropertyGridImageProperty(_T("ItemBkImage"),_T(""),_T("指定组项正常显示时的图片"),tagItemBkImage);//itembkimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ItemHotImage"),_T(""),_T("指定组项获得热点时的图片"),tagItemHotImage);//itemhotimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ItemSelectedImage"),_T(""),_T("指定组项被选择时的图片"),tagItemSelectedImage);//itemselectedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ItemDisabledImage"),_T(""),_T("指定组项被禁用后的图片"),tagItemDisabledImage);//itemdisabledimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
//itemtextpadding
pValueList=new CMFCPropertyGridProperty(_T("ItemTextPadding"),tagItemTextPadding,TRUE);
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("指定组项文本区域的左边距\n0"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("指定组项文本区域的上边距\n0"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("指定组项文本区域的右边距\n0"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("指定组项文本区域的下边距\n0"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
//itemalign
pProp=new CMFCPropertyGridProperty(_T("ItemAlign"),_T("Center"),_T("指示组项文本的对齐方式\nCenter"),tagItemAlign);
pProp->AddOption(_T("Center"));
pProp->AddOption(_T("Left"));
pProp->AddOption(_T("Right"));
pProp->AllowEdit(FALSE);
pPropUI->AddSubItem(pProp);
//itemtextcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemTextColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项文本的颜色"),tagItemTextColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itembkcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemBkColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项背景的颜色"),tagItemBkColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itemselectedtextcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemSelectedTextColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项被选中后文本的颜色"),tagItemSelectedTextColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itemselectedbkcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemSelectedBkColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项被选中后背景的颜色"),tagItemSelectedBkColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itemhottextcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemHotTextColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项获得热点时文本的颜色"),tagItemHotTextColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itemhotbkcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemHotBkColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项获得热点时背景的颜色"),tagItemHotBkColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itemdisabledtextcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemDisabledTextColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项被禁用后文本的颜色"),tagItemDisabledTextColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//itemdisabledbkcolor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemDisabledBkColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项被禁用后背景的颜色"),tagItemDisabledBkColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//ItemLineColor
pPropColor=new CMFCPropertyGridColor32Property(_T("ItemLineColor"),(LONG)ARGB(0,0,0,0),NULL,_T("指定组项分割线的颜色"),tagItemLineColor);
pPropColor->EnableOtherButton(_T("其他..."));
pPropColor->EnableAutomaticButton(_T("默认"),::GetSysColor(COLOR_3DFACE));
pPropUI->AddSubItem(pPropColor);
//ItemFont
pProp=new CMFCPropertyGridProperty(_T("ItemFont"),(_variant_t)(LONG)-1,_T("指定组项文本的字体\n-1"),tagItemFont);
pPropUI->AddSubItem(pProp);
//ItemShowHtml
pProp=new CMFCPropertyGridProperty(_T("ItemShowHtml"),(_variant_t)false,_T("指示是否使用Html格式文本\nFalse"),tagItemShowHtml);
pPropUI->AddSubItem(pProp);
//MultiExpanding
pProp=new CMFCPropertyGridProperty(_T("MultiExpanding"),(_variant_t)false,_T("指示是否支持多个item同时打开\nFalse"),tagMultiExpanding);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Item
//Combo
#pragma region Combo
pPropUI=new CMFCPropertyGridProperty(_T("Combo"),classCombo);
pPropImage=new CMFCPropertyGridImageProperty(_T("NormalImage"),_T(""),_T("指定组合框正常显示时的图片"),tagComboNormalImage);//normalimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("HotImage"),_T(""),_T("指定组合框获得热点时的图片"),tagComboHotImage);//hotimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("PushedImage"),_T(""),_T("指定组合框被按压下时的图片"),tagComboPushedImage);//pushedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("FocusedImage"),_T(""),_T("指定组合框获得焦点后的图片"),tagComboFocusedImage);//focusedimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("DisabledImage"),_T(""),_T("指定组合框被禁用后的图片"),tagComboDisabledImage);//disabledimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pValueList=new CMFCPropertyGridProperty(_T("TextPadding"),tagComboTextPadding,TRUE);//textpadding
pProp=new CMFCPropertyGridProperty(_T("Left"),(_variant_t)(LONG)0,_T("指定文本区域的左边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Top"),(_variant_t)(LONG)0,_T("指定文本区域的上边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Right"),(_variant_t)(LONG)0,_T("指定文本区域的右边距"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Bottom"),(_variant_t)(LONG)0,_T("指定文本区域的下边距"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
pValueList=new CMFCPropertyGridProperty(_T("DropBoxSize"),tagComboDropBoxSize,TRUE);//dropboxsize
pProp=new CMFCPropertyGridProperty(_T("Width"),(_variant_t)(LONG)0,_T("下拉列表的宽度"));
pValueList->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Height"),(_variant_t)(LONG)0,_T("下拉列表的高度"));
pValueList->AddSubItem(pProp);
pPropUI->AddSubItem(pValueList);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion Combo
//HorizontalLayout
#pragma region HorizontalLayout
pPropUI=new CMFCPropertyGridProperty(_T("HorizontalLayout"),classHorizontalLayout);
pProp=new CMFCPropertyGridProperty(_T("SepWidth"),(_variant_t)(LONG)0,_T("分隔符宽,正负表示分隔符在左边还是右边\n0"),tagSepWidth);//sepwidth
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("SepImm"),(_variant_t)false,_T("拖动分隔符是否立即改变大小\nfalse"),tagSepImm);//sepimm
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion HorizontalLayout
//TileLayout
#pragma region TileLayout
pPropUI=new CMFCPropertyGridProperty(_T("TileLayout"),classTileLayout);
pProp=new CMFCPropertyGridProperty(_T("Columns"),(_variant_t)(LONG)0,_T("指定并列布局的列数"),tagColumns);//columns
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion TileLayout
//List
#pragma region List
pPropUI=new CMFCPropertyGridProperty(_T("List"),classList);
pProp=new CMFCPropertyGridProperty(_T("Header"),(_variant_t)false,_T("指定是否显示列表表头\nTrue"),tagListHeader);
pPropUI->AddSubItem(pProp);
pPropImage=new CMFCPropertyGridImageProperty(_T("headerbkimage"),_T(""),_T("指定表头背景图片"),tagListHeaderBKImage);//normalimage
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion List
//ScrollBar
#pragma region ScrollBar
pPropUI=new CMFCPropertyGridProperty(_T("ScrollBar"),classScrollBar);
pProp=new CMFCPropertyGridProperty(_T("Range"),(_variant_t)(LONG)0,_T("指定滚动范围\n100"),tagScrollBarRange);
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("Value"),(_variant_t)(LONG)0,_T("指定滚动位置\n0"),tagScrollBarValue);
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("LineSize"),(_variant_t)(LONG)0,_T("指定滚动一行的大小\n8"),tagScrollBarLineSize);
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("ShowButton1"),(_variant_t)false,_T("是否显示左或上按钮\nTrue"),tagScrollBarShowButton1);
pPropUI->AddSubItem(pProp);
pProp=new CMFCPropertyGridProperty(_T("ShowButton2"),(_variant_t)false,_T("是否显示左或上按钮\nTrue"),tagScrollBarShowButton2);
pPropUI->AddSubItem(pProp);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button1NormalImage"),_T(""),_T("指定左或上按钮普通状态图片"),tagScrollBarButton1NormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button1HotImage"),_T(""),_T("指定左或上按钮鼠标悬浮状态图片"),tagScrollBarButton1HotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button1PushedImage"),_T(""),_T("指定左或上按钮鼠标按下状态图片"),tagScrollBarButton1PushedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button1DisabledImage"),_T(""),_T("指定左或上按钮鼠标禁用状态图片"),tagScrollBarButton1DisabledImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button2NormalImage"),_T(""),_T("指定左或上按钮普通状态图片"),tagScrollBarButton2NormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button2HotImage"),_T(""),_T("指定左或上按钮鼠标悬浮状态图片"),tagScrollBarButton2HotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button2PushedImage"),_T(""),_T("指定左或上按钮鼠标按下状态图片"),tagScrollBarButton2PushedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("Button2DisabledImage"),_T(""),_T("指定左或上按钮鼠标悬禁用态图片"),tagScrollBarButton2DisabledImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbNormalImage"),_T(""),_T("指定滑块普通状态图片"),tagScrollBarThumbNormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbHotImage"),_T(""),_T("指定滑块鼠标悬浮状态图片"),tagScrollBarThumbHotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbPushedImage"),_T(""),_T("指定滑块鼠标按下状态图片"),tagScrollBarThumbPushedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("ThumbDisabledImage"),_T(""),_T("指定滑块禁用状态图片"),tagScrollBarThumbDisabledImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("RailNormalImage"),_T(""),_T("指定滑块中间标识普通状态图片"),tagScrollBarRailNormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("RailHotImage"),_T(""),_T("指定滑块中间标识鼠标悬浮状态图片"),tagScrollBarRailHotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("RailPushedImage"),_T(""),_T("指定滑块中间标识鼠标按下状态图片"),tagScrollBarRailPushedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("RailDisabledImage"),_T(""),_T("指定滑块中间标识禁用状态图片"),tagScrollBarRailDisabledImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("BKNormalImage"),_T(""),_T("指定背景普通状态图片"),tagScrollBarBKNormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("BKHotImage"),_T(""),_T("指定背景鼠标悬浮状态图片"),tagScrollBarBKHotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("BKPushedImage"),_T(""),_T("指定背景鼠标按下状态图片"),tagScrollBarBKPushedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
pPropImage=new CMFCPropertyGridImageProperty(_T("BKDisabledImage"),_T(""),_T("指定背景禁用状态图片"),tagScrollBarBKDisabledImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion ScrollBar
#pragma region TabLayout
pPropUI=new CMFCPropertyGridProperty(_T("TabLayout"),classTabLayout);
// selectedid
pProp=new CMFCPropertyGridProperty(_T("selectedid"),(_variant_t)(LONG)0,_T("默认选中的页面ID\n从0开始计数"),tagSelectedID);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion TabLayout
#pragma region ListHeaderItem
pPropUI=new CMFCPropertyGridProperty(_T("ListHeaderItem"),classListHeaderItem);
// dragable
pProp=new CMFCPropertyGridProperty(_T("Dragable"),(_variant_t)true,_T("是否可拖动改变大小\ntrue"),tagDragable);
pPropUI->AddSubItem(pProp);
// sepwidth
pProp=new CMFCPropertyGridProperty(_T("SepWidth"),(_variant_t)(LONG)0,_T("分隔符宽\n4"),tagListHeaderItemSepWidth);
pPropUI->AddSubItem(pProp);
// normalimage
pPropImage=new CMFCPropertyGridImageProperty(_T("NormalImage"),_T(""),_T("普通状态图片"),tagListHeaderItemNormalImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
// hotimage
pPropImage=new CMFCPropertyGridImageProperty(_T("HotImage"),_T(""),_T("鼠标悬浮的状态图片"),tagListHeaderItemHotImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
// PushedImage
pPropImage=new CMFCPropertyGridImageProperty(_T("PushedImage"),_T(""),_T("鼠标按下的状态图片"),tagListHeaderItemPushedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
// focusedimage
pPropImage=new CMFCPropertyGridImageProperty(_T("FocusedImage"),_T(""),_T("获得焦点时的状态图片"),tagListHeaderItemFocusedImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
// sepimage
pPropImage=new CMFCPropertyGridImageProperty(_T("SepImage"),_T(""),_T("拖动条图片"),tagSepImage);
pPropImage->AllowEdit(FALSE);
pPropUI->AddSubItem(pPropImage);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion ListHeaderItem
#pragma region WebBrowser
pPropUI=new CMFCPropertyGridProperty(_T("WebBrowser"),classWebBrowser);
// homepage
pProp=new CMFCPropertyGridProperty(_T("homepage"),(_variant_t)_T(""),_T("默认网址\n"),tagWebBrowserHomePage);
pPropUI->AddSubItem(pProp);
// autonavi
pProp=new CMFCPropertyGridProperty(_T("autonavi"),(_variant_t)true,_T("是否显示默认页面\ntrue"),tagDragable);
pPropUI->AddSubItem(pProp);
m_wndPropList.AddProperty(pPropUI);
#pragma endregion WebBrowser
/*HideAllProperties();*/
}
void CUIProperties::SetPropListFont()
{
::DeleteObject(m_fntPropList.Detach());
LOGFONT lf;
afxGlobalData.fontRegular.GetLogFont(&lf);
NONCLIENTMETRICS info;
info.cbSize = sizeof(info);
afxGlobalData.GetNonClientMetrics(info);
lf.lfHeight = info.lfMenuFont.lfHeight;
lf.lfWeight = info.lfMenuFont.lfWeight;
lf.lfItalic = info.lfMenuFont.lfItalic;
m_fntPropList.CreateFontIndirect(&lf);
m_wndPropList.SetFont(&m_fntPropList);
}
void CUIProperties::HideAllProperties(BOOL bAdjustLayout/*=FALSE*/)
{
for(int i=0; iShow(FALSE, bAdjustLayout);
}
#pragma once
//
//CMFCPropertyGridColor32Property
#define ARGB(a,r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))|(((DWORD)(BYTE)(a))<<24))
#define GetAValue(argb) (LOBYTE((argb)>>24))
class CMFCPropertyGridColor32Property : public CMFCPropertyGridColorProperty
{
public:
CMFCPropertyGridColor32Property(const CString& strName,const COLORREF& color,CPalette* pPalette=NULL,LPCTSTR lpszDescr=NULL,DWORD_PTR dwData=0);
public:
virtual BOOL OnUpdateValue();
virtual void OnDrawValue(CDC* pDC, CRect rect);
virtual CString FormatProperty();
};
//
//CMFCPropertyGridImageProperty
#define AFX_PROP_HAS_BUTTON 0x0002
class CMFCPropertyGridImageProperty : public CMFCPropertyGridProperty
{
DECLARE_DYNAMIC(CMFCPropertyGridImageProperty)
public:
CMFCPropertyGridImageProperty(const CString& strName, const CString& strImage, LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0);
public:
virtual void OnClickButton(CPoint point);
};
//
//CMFCPropertyGridCustomFontsProperty
class CMFCPropertyGridCustomFontsProperty : public CMFCPropertyGridProperty
{
DECLARE_DYNAMIC(CMFCPropertyGridCustomFontsProperty)
public:
CMFCPropertyGridCustomFontsProperty(const CString& strName, const COleVariant& varValue, LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0);
public:
virtual void OnClickButton(CPoint point);
};
//
//CMFCPropertyGridDefaultAttribListProperty
class CMFCPropertyGridDefaultAttribListProperty : public CMFCPropertyGridProperty
{
DECLARE_DYNAMIC(CMFCPropertyGridDefaultAttribListProperty)
public:
CMFCPropertyGridDefaultAttribListProperty(const CString& strName, const COleVariant& varValue, LPCTSTR lpszDescr = NULL, DWORD_PTR dwData = 0);
public:
virtual void OnClickButton(CPoint point);
};
//
//CPropertiesToolBar
class CPropertiesToolBar : public CMFCToolBar
{
public:
virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler)
{
CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler);
}
virtual BOOL AllowShowOnList() const { return FALSE; }
};
//
//CUIProperties
enum PropertyTag
{
tagNULL=0,
//Window
tagWindow,
tagWindowSize=tagWindow,
tagCaption,
tagSizeBox,
tagRoundCorner,
tagMinInfo,
tagMaxInfo,
tagShowDirty,
tagCustomFonts,
tagDefaultAttribList,
tagAlpha,
tagBkTrans,
tagDefaultFontColor,
tagSelectedFontColor,
tagDisabledFontColor,
tagLinkFontColor,
tagLinkHoverFontColor,
//Control
tagControl,
tagName=tagControl,
tagText,
tagPos,
tagRelativePos,
tagSize,
tagMinSize,
tagMaxSize,
tagPadding,
tagBkImage,
tagBkColor,
tagBkColor2,
tagBorderColor,
tagFocusBorderColor,
tagBorderSize,
tagBorderRound,
tagEnabled,
tagFloat,
tagVisible,
tagMouse,
tagMenu,
tagColorHSL,
tagTooltip,
tagUserData,
tagKeyBoard,
//Label
tagLabel,
tagAlign=tagLabel,
tagTextColor,
tagDisabledTextColor,
tagFont,
tagTextPadding,
tagShowHtml,
tagEndEllipsis,
//Button
tagButton,
tagNormalImage=tagButton,
tagHotImage,
tagPushedImage,
tagFocusedImage,
tagDisabledImage,
//Edit
tagEdit,
tagEditNormalImage=tagEdit,
tagEditHotImage,
tagEditFocusedImage,
tagEditDisabledImage,
tagReadOnly,
tagPassword,
tagMaxChar,
tagNativeBKColor,
//Option
tagOption,
tagOptForeImage=tagOption,
tagSelectedImage,
tagSelected,
tagGroup,
//Progress
tagProgress,
tagForeImage=tagProgress,
tagMinMax,
tagValue,
tagHor,
tagIsStretchFore,
//Slider
tagSlider,
tagThumbImage=tagSlider,
tagThumbHotImage,
tagThumbPushedImage,
tagThumbSize,
//Item
tagItem,
tagItemBkImage=tagItem,
tagItemHotImage,
tagItemSelectedImage,
tagItemDisabledImage,
tagItemTextPadding,
tagItemAlign,
tagItemTextColor,
tagItemBkColor,
tagItemSelectedTextColor,
tagItemSelectedBkColor,
tagItemHotTextColor,
tagItemHotBkColor,
tagItemDisabledTextColor,
tagItemDisabledBkColor,
tagItemLineColor,
tagItemFont,
tagItemShowHtml,
tagMultiExpanding,
//Combo
tagCombo,
tagComboNormalImage=tagCombo,
tagComboHotImage,
tagComboPushedImage,
tagComboFocusedImage,
tagComboDisabledImage,
tagComboTextPadding,
tagComboDropBoxSize,
//ActiveX
tagActiveX,
tagClsid=tagActiveX,
tagDelayCreate,
tagModuleName,
//Container
tagContainer,
tagInset=tagContainer,
tagChildPadding,
tagMouseChild,
tagHScrollBar,
tagVScrollBar,
//HorizontalLayout
tagHorizontalLayout,
tagSepWidth=tagHorizontalLayout,
tagSepImm,
//TileLayout
tagTileLayout,
tagColumns=tagTileLayout,
//List
tagList,
tagListHeader=tagList,
tagListHeaderBKImage,
//ScrollBar
tagScrollBar,
tagScrollBarRange=tagScrollBar,
tagScrollBarValue,
tagScrollBarLineSize,
tagScrollBarShowButton1,
tagScrollBarShowButton2,
tagScrollBarButton1NormalImage,
tagScrollBarButton1HotImage,
tagScrollBarButton1PushedImage,
tagScrollBarButton1DisabledImage,
tagScrollBarButton2NormalImage,
tagScrollBarButton2HotImage,
tagScrollBarButton2PushedImage,
tagScrollBarButton2DisabledImage,
tagScrollBarThumbNormalImage,
tagScrollBarThumbHotImage,
tagScrollBarThumbPushedImage,
tagScrollBarThumbDisabledImage,
tagScrollBarRailNormalImage,
tagScrollBarRailHotImage,
tagScrollBarRailPushedImage,
tagScrollBarRailDisabledImage,
tagScrollBarBKNormalImage,
tagScrollBarBKHotImage,
tagScrollBarBKPushedImage,
tagScrollBarBKDisabledImage,
// TabLayout
tagTabLayout,
tagSelectedID=tagTabLayout,
// ListHeaderItem
tagListHeaderItem,
tagDragable=tagListHeaderItem,
tagListHeaderItemSepWidth,
tagListHeaderItemNormalImage,
tagListHeaderItemHotImage,
tagListHeaderItemPushedImage,
tagListHeaderItemFocusedImage,
tagSepImage,
// WebBrowser
tagWebBrowser,
tagWebBrowserHomePage=tagWebBrowser,
tagWebBrowserAutoNavi,
};
extern UINT WM_UI_PROPERTY_CHANGED;
class CUIProperties : public CWnd
{
DECLARE_DYNAMIC(CUIProperties)
public:
CUIProperties(void);
virtual ~CUIProperties(void);
public:
virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
void SetVSDotNetLook(BOOL bSet);
void AdjustLayout();
void ShowProperty();
CMFCPropertyGridProperty* FindPropByData(DWORD_PTR dwData, BOOL bSearchSubProps = TRUE) const;
static CString FormatOrigProperty(CMFCPropertyGridProperty* pProp);
protected:
void InitPropList(); //初始化设置值
void SetPropListFont();
void HideAllProperties(BOOL bAdjustLayout=FALSE);
protected:
CMFCPropertyGridCtrl m_wndPropList;
CPropertiesToolBar m_wndToolBar;
CFont m_fntPropList;
protected:
DECLARE_MESSAGE_MAP()
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg LRESULT OnPropertyChanged(WPARAM wp, LPARAM lp);
afx_msg void OnPropertiesSort();
afx_msg void OnUpdatePropertiesSort(CCmdUI* pCmdUI);
afx_msg void OnPropertiesAlphaBetic();
afx_msg void OnUpdatePropertiesAlphaBetic(CCmdUI* pCmdUI);
};
/****************************************
.h 中
private:
CUIProperties m_wndUIProperties;
public:
afx_msg void OnSize(UINT nType, int cx, int cy);
void AdjustLayout();
****************************************/
BOOL CLoginDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 将“关于...”菜单项添加到系统菜单中。
// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
// TODO: 在此添加额外的初始化代码
CRect rectDummy;
rectDummy.SetRectEmpty();
m_wndUIProperties.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, ID_UI_PROP_WND);
AdjustLayout();
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
void CLoginDlg::OnSize(UINT nType, int cx, int cy)
{
CDialogEx::OnSize(nType, cx, cy);
// TODO: 在此处添加消息处理程序代码
AdjustLayout();
}
void CLoginDlg::AdjustLayout()
{
if(m_wndUIProperties.GetSafeHwnd() == NULL)
return;
CRect rectClient;
GetClientRect(rectClient);
m_wndUIProperties.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), rectClient.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
}
//UI type
enum UIType
{
typeControl=1,
typeContainer,
typeForm,
};
//UI class
enum UIClass
{
classPointer=100,
classWindow,
classControl,
classButton,
classEdit,
classLabel,
classText,
classOption,
classCombo,
classList,
classSlider,
classProgress,
classActiveX,
classContainer,
classVerticalLayout,
classHorizontalLayout,
classTabLayout,
classTileLayout,
classListHeader,
classListHeaderItem,
classListTextElement,
classListLabelElement,
classListExpandElement,
classListContainerElement,
classItem,
classScrollBar,
classChildLayout,
classWebBrowser
};
typedef struct tagExtendedAttributes
{
HTREEITEM hItem;
int nClass;
int nDepth;
}ExtendedAttributes;