首页 > 代码库 > Codejock Xtreme ToolkitPro MFC 15.1.3.0908(Full Source) 汉化与添加搜索框

Codejock Xtreme ToolkitPro MFC 15.1.3.0908(Full Source) 汉化与添加搜索框

Codejock Xtreme ToolkitPro MFC 15.1.3.0908(Full Source) 

1、安装序列号

B0B50-00000-A301C-00000-3ADC6

2、汉化过程

1、Source\XTToolkitPro.rc中找到

#defineLANGUAGE_DEFAULT(ProdName) <##ProdName##\res\Resource.rc>

在它的前面一行加上:

#define _XTP_RESOURCE_LANGUAGE zh_CN

即:

 

2、Workspace\ToolkitPro\ToolkitPro.rc中找到下面一行:

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

         将其改为:

LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED

即:


 

3、添加搜索框


1、打开Source\CommandBars\Resouce.h找到

#defineXTP_IDC_LIST_COMMANDS           101

在其后添加一句:

#define XTP_IDC_EDIT_FIND_COMMAND      102

如下图所示:



2、打开Source\CommandBars\Res\ Resource_zh_CN.rc

搜索XTP_IDD_PAGE_COMMANDS,找到对话框资源信息,修改里面的参数,如下代码片段中的红色部分:

XTP_IDD_PAGE_COMMANDS DIALOGEX DISCARDABLE  0, 0, 230, 150

STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION

CAPTION "命令(&C)"

FONT 9, "宋体"

BEGIN

    LTEXT           "在工具栏中添加新命令: 选择类别并将命令从此对话框拖放至工具栏。",

                    IDC_STATIC,4,5,260,19

    LTEXT           "类别(&G):",IDC_STATIC,4,25,80,8

    LISTBOX         XTP_IDC_LIST_CATEGORIES,4,35,81,111,LBS_NOINTEGRALHEIGHT |

                    WS_VSCROLL | WS_TABSTOP

    LTEXT           "命令(&D):",IDC_STATIC,90,25,134,8

    EDITTEXT        XTP_IDC_EDIT_FIND_COMMAND,122,22,163,13,ES_AUTOHSCROLL

    LISTBOX         XTP_IDC_LIST_COMMANDS,90,35,135,111,LBS_OWNERDRAWFIXED |

                    LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP

END

 

如下图所示:

 

3、打开\Source\CommandBars\XTPCustomizeCommandsPage.h

找到以下代码,添加红色部分代码:afx_msgvoid OnEnChangeEditFindCommand();

//{{AFX_MSG(CXTPCustomizeCommandsPage)

         afx_msg void OnCategoriesSelectionChanged();

         afx_msg void OnDestroy();

         afx_msg void OnEnChangeEditFindCommand();

//}}AFX_MSG

如下图所示:

        

4、打开\Source\CommandBars\XTPCustomizeCommandsPage.cpp

找到以下代码,添加红色部分代码:ON_EN_CHANGE(XTP_IDC_EDIT_FIND_COMMAND,OnEnChangeEditFindCommand)

 

BEGIN_MESSAGE_MAP(CXTPCustomizeCommandsPage, CXTPPropertyPage)

         //{{AFX_MSG_MAP(CXTPCustomizeCommandsPage)

         ON_LBN_SELCHANGE(XTP_IDC_LIST_CATEGORIES, OnCategoriesSelectionChanged)

         ON_WM_DESTROY()

         ON_EN_CHANGE(XTP_IDC_EDIT_FIND_COMMAND, OnEnChangeEditFindCommand)

         //}}AFX_MSG_MAP

END_MESSAGE_MAP()

即:

同时添加函数实现体:

void CXTPCustomizeCommandsPage::OnEnChangeEditFindCommand()

{

         // TODO:  如果该控件是 RICHEDIT控件,则它将不会

         // 发送该通知,除非重写 CXTResizeDialog::OnInitDialog()

         // 函数并调用 CRichEditCtrl().SetEventMask()

         // 同时将 ENM_CHANGE标志“或”运算到掩码中。

    CString str;

         GetDlgItemText(XTP_IDC_EDIT_FIND_COMMAND,str);

         str.MakeUpper();

         str.TrimLeft();

         str.TrimRight();

         m_lstCommands.ResetContent();

         if (str.IsEmpty())

         {

                   OnCategoriesSelectionChanged();

         }

         else

         {

                   for (int i = 0; i < m_arrCategories.GetSize(); i++)

                   {

                            XTP_COMMANDBARS_CATEGORYINFO* pInfo = GetCategoryInfo(i);

                            if (pInfo == NULL)  continue;

                            for (int j = 0; j < pInfo->pControls->GetCount(); j++)

                            {

                                     CXTPControl* pControl = pInfo->pControls->GetAt(j);

                                     CString strText = pControl->GetCaption();

                                     strText.MakeUpper();

                                     if (strText.Find(str)>=0)

                                     {

                                               m_lstCommands.SendMessage(LB_INSERTSTRING,

                                                                                                  m_lstCommands.GetCount(),

                                                                                                  (LPARAM)pControl);

                                     }

                            }

                   }

         }

}

 

Codejock Xtreme ToolkitPro MFC 15.1.3.0908(Full Source) 汉化与添加搜索框