提交 | 用户 | age
|
0ed438
|
1 |
|
Q |
2 |
// MainFrm.cpp: CMainFrame 类的实现
|
|
3 |
//
|
|
4 |
|
|
5 |
#include "pch.h"
|
|
6 |
#include "framework.h"
|
|
7 |
#include "MTerm1.h"
|
|
8 |
|
|
9 |
#include "MainFrm.h"
|
|
10 |
|
|
11 |
#ifdef _DEBUG
|
|
12 |
#define new DEBUG_NEW
|
|
13 |
#endif
|
|
14 |
|
|
15 |
// CMainFrame
|
|
16 |
|
|
17 |
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx)
|
|
18 |
|
|
19 |
const int iMaxUserToolbars = 10;
|
|
20 |
const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40;
|
|
21 |
const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1;
|
|
22 |
|
|
23 |
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
|
|
24 |
ON_WM_CREATE()
|
|
25 |
ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager)
|
|
26 |
ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize)
|
|
27 |
ON_REGISTERED_MESSAGE(AFX_WM_CREATETOOLBAR, &CMainFrame::OnToolbarCreateNew)
|
|
28 |
ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnApplicationLook)
|
|
29 |
ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnUpdateApplicationLook)
|
|
30 |
ON_WM_SETTINGCHANGE()
|
|
31 |
END_MESSAGE_MAP()
|
|
32 |
|
|
33 |
static UINT indicators[] =
|
|
34 |
{
|
|
35 |
ID_SEPARATOR, // 状态行指示器
|
|
36 |
ID_INDICATOR_CAPS,
|
|
37 |
ID_INDICATOR_NUM,
|
|
38 |
ID_INDICATOR_SCRL,
|
|
39 |
};
|
|
40 |
|
|
41 |
// CMainFrame 构造/析构
|
|
42 |
|
|
43 |
CMainFrame::CMainFrame() noexcept
|
|
44 |
{
|
|
45 |
// TODO: 在此添加成员初始化代码
|
|
46 |
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_WIN_2000); // ID_VIEW_APPLOOK_VS_2008);
|
|
47 |
}
|
|
48 |
|
|
49 |
CMainFrame::~CMainFrame()
|
|
50 |
{
|
|
51 |
}
|
|
52 |
|
|
53 |
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
54 |
{
|
|
55 |
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
|
|
56 |
return -1;
|
|
57 |
|
|
58 |
BOOL bNameValid;
|
|
59 |
|
|
60 |
CMDITabInfo mdiTabParams;
|
|
61 |
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式...
|
|
62 |
mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧
|
|
63 |
mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标
|
|
64 |
mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色
|
|
65 |
mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单
|
|
66 |
// EnableMDITabbedGroups(TRUE, mdiTabParams);
|
|
67 |
|
|
68 |
if (!m_wndMenuBar.Create(this))
|
|
69 |
{
|
|
70 |
TRACE0("未能创建菜单栏\n");
|
|
71 |
return -1; // 未能创建
|
|
72 |
}
|
|
73 |
|
|
74 |
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);
|
|
75 |
|
|
76 |
// 防止菜单栏在激活时获得焦点
|
|
77 |
CMFCPopupMenu::SetForceMenuFocus(FALSE);
|
|
78 |
|
|
79 |
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
|
80 |
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
|
|
81 |
{
|
|
82 |
TRACE0("未能创建工具栏\n");
|
|
83 |
return -1; // 未能创建
|
|
84 |
}
|
|
85 |
|
|
86 |
CString strToolBarName;
|
|
87 |
bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);
|
|
88 |
ASSERT(bNameValid);
|
|
89 |
m_wndToolBar.SetWindowText(strToolBarName);
|
|
90 |
|
|
91 |
CString strCustomize;
|
|
92 |
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
|
|
93 |
ASSERT(bNameValid);
|
|
94 |
m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
|
|
95 |
|
|
96 |
// 允许用户定义的工具栏操作:
|
|
97 |
InitUserToolbars(nullptr, uiFirstUserToolBarId, uiLastUserToolBarId);
|
|
98 |
|
|
99 |
if (!m_wndStatusBar.Create(this))
|
|
100 |
{
|
|
101 |
TRACE0("未能创建状态栏\n");
|
|
102 |
return -1; // 未能创建
|
|
103 |
}
|
|
104 |
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
|
|
105 |
|
|
106 |
// TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行
|
|
107 |
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
|
|
108 |
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
|
109 |
EnableDocking(CBRS_ALIGN_ANY);
|
|
110 |
DockPane(&m_wndMenuBar);
|
|
111 |
DockPane(&m_wndToolBar);
|
|
112 |
|
|
113 |
|
|
114 |
// 启用 Visual Studio 2005 样式停靠窗口行为
|
|
115 |
CDockingManager::SetDockingMode(DT_SMART);
|
|
116 |
// 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为
|
|
117 |
EnableAutoHidePanes(CBRS_ALIGN_ANY);
|
|
118 |
|
|
119 |
// 加载菜单项图像(不在任何标准工具栏上):
|
|
120 |
CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0);
|
|
121 |
|
|
122 |
// 创建停靠窗口
|
|
123 |
if (!CreateDockingWindows())
|
|
124 |
{
|
|
125 |
TRACE0("未能创建停靠窗口\n");
|
|
126 |
return -1;
|
|
127 |
}
|
|
128 |
|
|
129 |
m_wndFileView.EnableDocking(CBRS_ALIGN_ANY);
|
|
130 |
m_wndClassView.EnableDocking(CBRS_ALIGN_ANY);
|
|
131 |
DockPane(&m_wndFileView);
|
|
132 |
CDockablePane* pTabbedBar = nullptr;
|
|
133 |
m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar);
|
|
134 |
m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
|
|
135 |
DockPane(&m_wndOutput);
|
|
136 |
m_wndProperties.EnableDocking(CBRS_ALIGN_ANY);
|
|
137 |
DockPane(&m_wndProperties);
|
|
138 |
|
|
139 |
// 基于持久值设置视觉管理器和样式
|
|
140 |
OnApplicationLook(theApp.m_nAppLook);
|
|
141 |
|
|
142 |
// 启用增强的窗口管理对话框
|
|
143 |
EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE);
|
|
144 |
|
|
145 |
// 启用工具栏和停靠窗口菜单替换
|
|
146 |
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);
|
|
147 |
|
|
148 |
// 启用快速(按住 Alt 拖动)工具栏自定义
|
|
149 |
CMFCToolBar::EnableQuickCustomization();
|
|
150 |
|
|
151 |
if (CMFCToolBar::GetUserImages() == nullptr)
|
|
152 |
{
|
|
153 |
// 加载用户定义的工具栏图像
|
|
154 |
if (m_UserImages.Load(_T(".\\UserImages.bmp")))
|
|
155 |
{
|
|
156 |
CMFCToolBar::SetUserImages(&m_UserImages);
|
|
157 |
}
|
|
158 |
}
|
|
159 |
|
|
160 |
// 启用菜单个性化(最近使用的命令)
|
|
161 |
// TODO: 定义您自己的基本命令,确保每个下拉菜单至少有一个基本命令。
|
|
162 |
CList<UINT, UINT> lstBasicCommands;
|
|
163 |
|
|
164 |
lstBasicCommands.AddTail(ID_FILE_NEW);
|
|
165 |
lstBasicCommands.AddTail(ID_FILE_OPEN);
|
|
166 |
lstBasicCommands.AddTail(ID_FILE_SAVE);
|
|
167 |
lstBasicCommands.AddTail(ID_FILE_PRINT);
|
|
168 |
lstBasicCommands.AddTail(ID_APP_EXIT);
|
|
169 |
lstBasicCommands.AddTail(ID_EDIT_CUT);
|
|
170 |
lstBasicCommands.AddTail(ID_EDIT_PASTE);
|
|
171 |
lstBasicCommands.AddTail(ID_EDIT_UNDO);
|
|
172 |
lstBasicCommands.AddTail(ID_APP_ABOUT);
|
|
173 |
lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR);
|
|
174 |
lstBasicCommands.AddTail(ID_VIEW_TOOLBAR);
|
|
175 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003);
|
|
176 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005);
|
|
177 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE);
|
|
178 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER);
|
|
179 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK);
|
|
180 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA);
|
|
181 |
lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7);
|
|
182 |
lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC);
|
|
183 |
lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE);
|
|
184 |
lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS);
|
|
185 |
lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE);
|
|
186 |
|
|
187 |
// CMFCToolBar::SetBasicCommands(lstBasicCommands);
|
|
188 |
|
|
189 |
// 将文档名和应用程序名称在窗口标题栏上的顺序进行交换。这
|
|
190 |
// 将改进任务栏的可用性,因为显示的文档名带有缩略图。
|
|
191 |
ModifyStyle(0, FWS_PREFIXTITLE);
|
|
192 |
|
|
193 |
return 0;
|
|
194 |
}
|
|
195 |
|
|
196 |
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
|
197 |
{
|
|
198 |
if( !CMDIFrameWndEx::PreCreateWindow(cs) )
|
|
199 |
return FALSE;
|
|
200 |
// TODO: 在此处通过修改
|
|
201 |
// CREATESTRUCT cs 来修改窗口类或样式
|
|
202 |
|
|
203 |
return TRUE;
|
|
204 |
}
|
|
205 |
|
|
206 |
BOOL CMainFrame::CreateDockingWindows()
|
|
207 |
{
|
|
208 |
BOOL bNameValid;
|
|
209 |
|
|
210 |
// 创建类视图
|
|
211 |
CString strClassView;
|
|
212 |
bNameValid = strClassView.LoadString(IDS_CLASS_VIEW);
|
|
213 |
ASSERT(bNameValid);
|
|
214 |
if (!m_wndClassView.Create(strClassView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_CLASSVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
|
|
215 |
{
|
|
216 |
TRACE0("未能创建“类视图”窗口\n");
|
|
217 |
return FALSE; // 未能创建
|
|
218 |
}
|
|
219 |
|
|
220 |
// 创建文件视图
|
|
221 |
CString strFileView;
|
|
222 |
bNameValid = strFileView.LoadString(IDS_FILE_VIEW);
|
|
223 |
ASSERT(bNameValid);
|
|
224 |
if (!m_wndFileView.Create(strFileView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_FILEVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
|
|
225 |
{
|
|
226 |
TRACE0("未能创建“文件视图”窗口\n");
|
|
227 |
return FALSE; // 未能创建
|
|
228 |
}
|
|
229 |
|
|
230 |
// 创建输出窗口
|
|
231 |
CString strOutputWnd;
|
|
232 |
bNameValid = strOutputWnd.LoadString(IDS_OUTPUT_WND);
|
|
233 |
ASSERT(bNameValid);
|
|
234 |
if (!m_wndOutput.Create(strOutputWnd, this, CRect(0, 0, 100, 100), TRUE, ID_VIEW_OUTPUTWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
|
|
235 |
{
|
|
236 |
TRACE0("未能创建输出窗口\n");
|
|
237 |
return FALSE; // 未能创建
|
|
238 |
}
|
|
239 |
|
|
240 |
// 创建属性窗口
|
|
241 |
CString strPropertiesWnd;
|
|
242 |
bNameValid = strPropertiesWnd.LoadString(IDS_PROPERTIES_WND);
|
|
243 |
ASSERT(bNameValid);
|
|
244 |
if (!m_wndProperties.Create(strPropertiesWnd, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_PROPERTIESWND, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_RIGHT | CBRS_FLOAT_MULTI))
|
|
245 |
{
|
|
246 |
TRACE0("未能创建“属性”窗口\n");
|
|
247 |
return FALSE; // 未能创建
|
|
248 |
}
|
|
249 |
|
|
250 |
SetDockingWindowIcons(theApp.m_bHiColorIcons);
|
|
251 |
return TRUE;
|
|
252 |
}
|
|
253 |
|
|
254 |
void CMainFrame::SetDockingWindowIcons(BOOL bHiColorIcons)
|
|
255 |
{
|
|
256 |
HICON hFileViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_FILE_VIEW_HC : IDI_FILE_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
|
|
257 |
m_wndFileView.SetIcon(hFileViewIcon, FALSE);
|
|
258 |
|
|
259 |
HICON hClassViewIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_CLASS_VIEW_HC : IDI_CLASS_VIEW), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
|
|
260 |
m_wndClassView.SetIcon(hClassViewIcon, FALSE);
|
|
261 |
|
|
262 |
HICON hOutputBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_OUTPUT_WND_HC : IDI_OUTPUT_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
|
|
263 |
m_wndOutput.SetIcon(hOutputBarIcon, FALSE);
|
|
264 |
|
|
265 |
HICON hPropertiesBarIcon = (HICON) ::LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(bHiColorIcons ? IDI_PROPERTIES_WND_HC : IDI_PROPERTIES_WND), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), 0);
|
|
266 |
m_wndProperties.SetIcon(hPropertiesBarIcon, FALSE);
|
|
267 |
|
|
268 |
UpdateMDITabbedBarsIcons();
|
|
269 |
}
|
|
270 |
|
|
271 |
// CMainFrame 诊断
|
|
272 |
|
|
273 |
#ifdef _DEBUG
|
|
274 |
void CMainFrame::AssertValid() const
|
|
275 |
{
|
|
276 |
CMDIFrameWndEx::AssertValid();
|
|
277 |
}
|
|
278 |
|
|
279 |
void CMainFrame::Dump(CDumpContext& dc) const
|
|
280 |
{
|
|
281 |
CMDIFrameWndEx::Dump(dc);
|
|
282 |
}
|
|
283 |
#endif //_DEBUG
|
|
284 |
|
|
285 |
|
|
286 |
// CMainFrame 消息处理程序
|
|
287 |
|
|
288 |
void CMainFrame::OnWindowManager()
|
|
289 |
{
|
|
290 |
ShowWindowsDialog();
|
|
291 |
}
|
|
292 |
|
|
293 |
void CMainFrame::OnViewCustomize()
|
|
294 |
{
|
|
295 |
CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* 扫描菜单*/);
|
|
296 |
pDlgCust->EnableUserDefinedToolbars();
|
|
297 |
pDlgCust->Create();
|
|
298 |
}
|
|
299 |
|
|
300 |
LRESULT CMainFrame::OnToolbarCreateNew(WPARAM wp,LPARAM lp)
|
|
301 |
{
|
|
302 |
LRESULT lres = CMDIFrameWndEx::OnToolbarCreateNew(wp,lp);
|
|
303 |
if (lres == 0)
|
|
304 |
{
|
|
305 |
return 0;
|
|
306 |
}
|
|
307 |
|
|
308 |
CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres;
|
|
309 |
ASSERT_VALID(pUserToolbar);
|
|
310 |
|
|
311 |
BOOL bNameValid;
|
|
312 |
CString strCustomize;
|
|
313 |
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
|
|
314 |
ASSERT(bNameValid);
|
|
315 |
|
|
316 |
pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
|
|
317 |
return lres;
|
|
318 |
}
|
|
319 |
|
|
320 |
void CMainFrame::OnApplicationLook(UINT id)
|
|
321 |
{
|
|
322 |
CWaitCursor wait;
|
|
323 |
|
|
324 |
theApp.m_nAppLook = id;
|
|
325 |
|
|
326 |
switch (theApp.m_nAppLook)
|
|
327 |
{
|
|
328 |
case ID_VIEW_APPLOOK_WIN_2000:
|
|
329 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager));
|
|
330 |
break;
|
|
331 |
|
|
332 |
case ID_VIEW_APPLOOK_OFF_XP:
|
|
333 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP));
|
|
334 |
break;
|
|
335 |
|
|
336 |
case ID_VIEW_APPLOOK_WIN_XP:
|
|
337 |
CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE;
|
|
338 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
|
339 |
break;
|
|
340 |
|
|
341 |
case ID_VIEW_APPLOOK_OFF_2003:
|
|
342 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003));
|
|
343 |
CDockingManager::SetDockingMode(DT_SMART);
|
|
344 |
break;
|
|
345 |
|
|
346 |
case ID_VIEW_APPLOOK_VS_2005:
|
|
347 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005));
|
|
348 |
CDockingManager::SetDockingMode(DT_SMART);
|
|
349 |
break;
|
|
350 |
|
|
351 |
case ID_VIEW_APPLOOK_VS_2008:
|
|
352 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008));
|
|
353 |
CDockingManager::SetDockingMode(DT_SMART);
|
|
354 |
break;
|
|
355 |
|
|
356 |
case ID_VIEW_APPLOOK_WINDOWS_7:
|
|
357 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7));
|
|
358 |
CDockingManager::SetDockingMode(DT_SMART);
|
|
359 |
break;
|
|
360 |
|
|
361 |
default:
|
|
362 |
switch (theApp.m_nAppLook)
|
|
363 |
{
|
|
364 |
case ID_VIEW_APPLOOK_OFF_2007_BLUE:
|
|
365 |
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
|
|
366 |
break;
|
|
367 |
|
|
368 |
case ID_VIEW_APPLOOK_OFF_2007_BLACK:
|
|
369 |
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
|
|
370 |
break;
|
|
371 |
|
|
372 |
case ID_VIEW_APPLOOK_OFF_2007_SILVER:
|
|
373 |
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
|
|
374 |
break;
|
|
375 |
|
|
376 |
case ID_VIEW_APPLOOK_OFF_2007_AQUA:
|
|
377 |
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
|
|
378 |
break;
|
|
379 |
}
|
|
380 |
|
|
381 |
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager));
|
|
382 |
CDockingManager::SetDockingMode(DT_SMART);
|
|
383 |
}
|
|
384 |
|
|
385 |
m_wndOutput.UpdateFonts();
|
|
386 |
RedrawWindow(nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);
|
|
387 |
|
|
388 |
theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook);
|
|
389 |
}
|
|
390 |
|
|
391 |
void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI)
|
|
392 |
{
|
|
393 |
pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID);
|
|
394 |
}
|
|
395 |
|
|
396 |
|
|
397 |
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
|
|
398 |
{
|
|
399 |
// 基类将执行真正的工作
|
|
400 |
|
|
401 |
if (!CMDIFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
|
|
402 |
{
|
|
403 |
return FALSE;
|
|
404 |
}
|
|
405 |
|
|
406 |
|
|
407 |
// 为所有用户工具栏启用自定义按钮
|
|
408 |
BOOL bNameValid;
|
|
409 |
CString strCustomize;
|
|
410 |
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
|
|
411 |
ASSERT(bNameValid);
|
|
412 |
|
|
413 |
for (int i = 0; i < iMaxUserToolbars; i ++)
|
|
414 |
{
|
|
415 |
CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i);
|
|
416 |
if (pUserToolbar != nullptr)
|
|
417 |
{
|
|
418 |
pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
return TRUE;
|
|
423 |
}
|
|
424 |
|
|
425 |
|
|
426 |
void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
|
|
427 |
{
|
|
428 |
CMDIFrameWndEx::OnSettingChange(uFlags, lpszSection);
|
|
429 |
m_wndOutput.UpdateFonts();
|
|
430 |
}
|