In this code snip, windowsizex and windowsizey are both variables that hold the current window size. When I print out the wxLogDebug for the resizefactor it comes out to values that would make sense to me given how much the panel has been resized. The sizer variable is the "topsizer" that I am using on my panel.
Code: Select all
void TestGUI::OnSize(wxSizeEvent& event)
{
wxLogDebug("On Size Event!");
int tempx = windowsizex;
int tempy = windowsizey;
float resizefactor = 0;
wxLogDebug("%d" , tempx);
wxLogDebug("%d" , tempy);
wxSize winsize = event.GetSize();
windowsizex = winsize.GetWidth();
windowsizey = winsize.GetHeight();
if(tempx != 0 && tempy != 0)
{
resizefactor = (((pow(sqrt(tempx / windowsizex),2)) + (pow(sqrt(tempy/windowsizey),2))) / (sqrt(2)));
resizefactor = (((windowsizex / tempx) + (windowsizey/ tempy))/1.4);
wxLogDebug("%.6f", resizefactor);
myFont->Scale(resizefactor);
SetFont(*myFont);
TestPanel->SetFont(*myFont);
//Refresh();
}
sizer->Layout();
Refresh();
event.Skip();
}