start:继续继续。

This commit is contained in:
taynpg 2025-05-13 23:14:41 +08:00
parent e8774bee10
commit c272847c8f
2 changed files with 17 additions and 25 deletions

View File

@ -4,26 +4,6 @@
#include <InfoCommunicate.hpp>
#include <wx/renderer.h>
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>& 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)

View File

@ -1,13 +1,28 @@
#include "UserInterface.h"
#include <wx/uilocale.h>
#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"));