#72 Font size scaling

open
nobody
5
2012-07-13
2010-03-22
Anonymous
No

Setting font to Small Medium Large in the control panel mess up the Dialog and Forms created by WxDev -i I pre process with a script to scale them
I'd like to see something like this added as an option to the layout editor.

//
// Find Fotn size once in APP when exe starts
//
extern float FontDpiScale;
wxClientDC *dc = new wxClientDC(this);
int w, h;
wxSize sz = dc->GetPPI();
w = sz.GetWidth();
h = sz.GetHeight();
delete dc;
//
// Scale font to fit as 96 dpi
//
FontDpiScale = 1.0;
if(w != 96 || h != 96 && w > 2)
{
FontDpiScale = 96.0/w;
}

//
// USE FontDpiScale against fon size selection Konstant in this case 7 pt was set
//
void MyDialog::CreateGUIControls()
{
//Do not add custom code between
//GUI Items Creation Start and GUI Items Creation End.
//wxDev-C++ designer will remove them.
//Add the custom code before or after the blocks
////GUI Items Creation Start
SetTitle(wxT("my Title"));
SetIcon(wxNullIcon);
SetSize(8,8,380,173);
Center();

WxButton3 = new wxButton(this, ID_WXBUTTON3, wxT("WxButton3"), wxPoint(256,112), wxSize(99,25), 0, wxDefaultValidator, wxT("WxButton3"));
WxButton3->SetFont(wxFont(int(7*FontDpiScale), wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")));

///----------------------------------------^^^^^^^^^^^^^^^^^
////GUI Items Creation End
}

Discussion


Anonymous


Cancel   Add attachments