From 3463c77d73bca0a97c89e7a61da7a97ec2c23e6c Mon Sep 17 00:00:00 2001
From: darker <mr.darker@163.com>
Date: 星期五, 17 一月 2025 11:12:32 +0800
Subject: [PATCH] 1.消除编译产生的警告 2.添加Rotate角度的旋转 3.提取绘画图像,并封装成函数
---
SourceCode/Bond/Servo/Servo.cpp | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/Servo.cpp b/SourceCode/Bond/Servo/Servo.cpp
index 81b50bc..550391a 100644
--- a/SourceCode/Bond/Servo/Servo.cpp
+++ b/SourceCode/Bond/Servo/Servo.cpp
@@ -7,6 +7,10 @@
#include "ServoDlg.h"
#include "ServoGraph.h"
+// 声明全局变量,用于管理 GDI+ 初始化
+ULONG_PTR g_diplusToken;
+GdiplusStartupInput g_diplusStartupInput;
+
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
@@ -81,10 +85,20 @@
_tsplitpath_s(sAppFilename, sDrive, sDir, sFilename, sExt);
m_strAppDir = CString(sDrive) + CString(sDir);
m_strAppFile = CString(sFilename);
+ m_model.setWorkDir((LPTSTR)(LPCTSTR)m_strAppDir);
// 注册控件
CServoGraph::RegisterWndClass();
+
+
+ // 初始化Rx库
+ RX_Init();
+ HSMS_Initialize();
+
+
+ // 初始化 GDI+
+ InitGDIPlus();
CServoDlg dlg;
@@ -117,3 +131,28 @@
return FALSE;
}
+int CServoApp::ExitInstance()
+{
+ m_model.term();
+ HSMS_Term();
+ RX_Term();
+
+ // 清理 GDI+
+ TermGDIPlus();
+
+ return CWinApp::ExitInstance();
+}
+
+// 初始化 GDI+
+void CServoApp::InitGDIPlus()
+{
+ // 初始化 GDI+ 图形库
+ GdiplusStartup(&g_diplusToken, &g_diplusStartupInput, NULL);
+}
+
+// 清理 GDI+
+void CServoApp::TermGDIPlus()
+{
+ // 清理 GDI+ 图形库
+ GdiplusShutdown(g_diplusToken);
+}
\ No newline at end of file
--
Gitblit v1.9.3