From c272847c8fd718df87faa244ea059233429f21e0 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 13 May 2025 23:14:41 +0800 Subject: [PATCH] =?UTF-8?q?start=EF=BC=9A=E7=BB=A7=E7=BB=AD=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UserInterface/RemoteControl.cxx | 25 +------------------------ UserInterface/main.cxx | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/UserInterface/RemoteControl.cxx b/UserInterface/RemoteControl.cxx index cbed5c2..fe498a9 100644 --- a/UserInterface/RemoteControl.cxx +++ b/UserInterface/RemoteControl.cxx @@ -4,26 +4,6 @@ #include #include -class ButtonCellRenderer : public wxGridCellRenderer -{ -public: - void Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected) override - { - wxRendererNative::Get().DrawPushButton(&grid, dc, rect, wxCONTROL_PRESSED); - dc.DrawText(grid.GetCellValue(row, col), rect.x + 5, rect.y + (rect.height - dc.GetCharHeight()) / 2); - } - - wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col) override - { - return wxSize(80, 25); // 按钮默认大小 - } - - wxGridCellRenderer* Clone() const override - { - return new ButtonCellRenderer; - } -}; - RemoteControl::RemoteControl(wxWindow* parent, std::shared_ptr& clientCore) : wxPanel(parent), clientCore_(clientCore) { Init(); @@ -156,7 +136,7 @@ void RemoteControl::OnRightClick(wxGridEvent& event) void RemoteControl::SetGrid() { - grid_->CreateGrid(10, 6); + grid_->CreateGrid(10, 5); for (int i = 0; i < 10; ++i) { grid_->DisableRowResize(i); @@ -173,9 +153,6 @@ void RemoteControl::SetGrid() grid_->SetColSize(2, 100); grid_->SetColSize(3, 150); grid_->SetColSize(4, 100); - - grid_->SetCellRenderer(0, 5, new ButtonCellRenderer()); - grid_->SetCellValue(0, 5, _("Download")); } void RemoteControl::setRemoteID(const wxString& id) diff --git a/UserInterface/main.cxx b/UserInterface/main.cxx index aa272b5..220a3d0 100644 --- a/UserInterface/main.cxx +++ b/UserInterface/main.cxx @@ -1,13 +1,28 @@ #include "UserInterface.h" #include +#ifdef _WIN32 +void setProcessDPIAwareIfAvailable() +{ + HMODULE hUser32 = LoadLibrary(wxT("User32.dll")); + if (hUser32) { + typedef BOOL(WINAPI * SetProcessDPIAwareFunc)(); + SetProcessDPIAwareFunc pSetProcessDPIAware = (SetProcessDPIAwareFunc)GetProcAddress(hUser32, "SetProcessDPIAware"); + if (pSetProcessDPIAware) { + pSetProcessDPIAware(); + } + FreeLibrary(hUser32); + } +} +#endif + class RelayFileApp : public wxApp { public: bool OnInit() override { #ifdef _WIN32 - SetProcessDPIAware(); + setProcessDPIAwareIfAvailable(); #endif loadLocale(); f_ = new UserInterface(_("RelayFile"));