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"));