From e0b180a728b4cb091fbf76172658409806121b6f Mon Sep 17 00:00:00 2001
From: darker <mr.darker@163.com>
Date: 星期四, 16 一月 2025 17:46:31 +0800
Subject: [PATCH] 1. 添加Robot移动标识 2. 添加Gdiplus模块 3. 添加Robot旋转的函数(未完成)
---
SourceCode/Bond/Servo/Servo.cpp | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/Servo.cpp b/SourceCode/Bond/Servo/Servo.cpp
index b422966..c1a7e0b 100644
--- a/SourceCode/Bond/Servo/Servo.cpp
+++ b/SourceCode/Bond/Servo/Servo.cpp
@@ -7,6 +7,11 @@
#include "ServoDlg.h"
#include "ServoGraph.h"
+using namespace Gdiplus;
+// 声明全局变量,用于管理 GDI+ 初始化
+ULONG_PTR g_diplusToken;
+GdiplusStartupInput g_diplusStartupInput;
+
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
@@ -93,6 +98,10 @@
HSMS_Initialize();
+ // 初始化 GDI+
+ InitGDIPlus();
+
+
CServoDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
@@ -129,5 +138,22 @@
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