From f03964e8e2e632a9e59b501f61cff9478f9f7203 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 06 一月 2025 14:39:48 +0800
Subject: [PATCH] 1.Log窗口自动调整修复;

---
 SourceCode/Bond/Servo/LogDlg.cpp |   13 +++++++++----
 SourceCode/Bond/Servo/LogDlg.h   |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/SourceCode/Bond/Servo/LogDlg.cpp b/SourceCode/Bond/Servo/LogDlg.cpp
index ce0617e..560b5cc 100644
--- a/SourceCode/Bond/Servo/LogDlg.cpp
+++ b/SourceCode/Bond/Servo/LogDlg.cpp
@@ -159,7 +159,7 @@
 
 
 	InitRxWindow();
-
+	Resize();
 
 
 	return TRUE;  // return TRUE unless you set the focus to a control
@@ -170,14 +170,18 @@
 {
 	CDialogEx::OnSize(nType, cx, cy);
 	if (GetDlgItem(IDC_EDIT_LOG) == nullptr) return;
+	Resize();
+}
 
+void CLogDlg::Resize()
+{
 	int x, y, y2, temp;
 	CRect rcClient, rcItem;
 	CWnd* pItem;
 	GetClientRect(&rcClient);
 
 	y = 0;
-	x = 12;
+	x = 8;
 	pItem = GetDlgItem(IDC_BUTTON_LEVEL);
 	pItem->GetWindowRect(&rcItem);
 	ScreenToClient(&rcItem);
@@ -185,6 +189,7 @@
 	x += rcItem.Width();
 	x += 18;
 	y2 = rcItem.bottom;
+	y2 += 8;
 
 	pItem = GetDlgItem(IDC_BUTTON_INCLUDE);
 	pItem->GetWindowRect(&rcItem);
@@ -203,9 +208,9 @@
 	pItem->GetWindowRect(&rcItem);
 	pItem->MoveWindow(x, y + (temp - rcItem.Height()) / 2, rcItem.Width(), rcItem.Height());
 
-	x = 12;
+	x = 8;
 	pItem = GetDlgItem(IDC_EDIT_LOG);
-	pItem->MoveWindow(x, y2, rcClient.Width() - 24, rcClient.Height() - 5 - y2);
+	pItem->MoveWindow(x, y2, rcClient.Width() - 16, rcClient.Height() - 5 - y2);
 }
 
 void CLogDlg::OnDestroy()
diff --git a/SourceCode/Bond/Servo/LogDlg.h b/SourceCode/Bond/Servo/LogDlg.h
index 457fcf7..29acf5a 100644
--- a/SourceCode/Bond/Servo/LogDlg.h
+++ b/SourceCode/Bond/Servo/LogDlg.h
@@ -21,6 +21,7 @@
 private:
 	void InitRxWindow();
 	void AppendLog(int level, const char* pszText);
+	void Resize();
 
 
 private:

--
Gitblit v1.9.3