skip to content

Widths and Themes

In the old DOS days, things were simple. You had 25 rows and 80 columns of text. Period. Well, if you knew the right tricks, you could double the rows or columns, but still it was pretty limited. This made programming fairly easy--you knew how much space you had to deal with.
With a GUI, or Graphical User Interface, things can get stretched out, you can have larger fonts, and you can have themes on or off. So knowing how much space you have to display stuff isn't quite as cut and dried. But I'm going to look at just one aspect that can be surprising: themes.
In Windows XP, you could turn themes on to get rounded corners and a 3D effect on buttons. But it didn't affect the size of the controls or the width of the programs.
But in Vista and in Windows 7, the new Aero Graphics increases the width of applications as shown in these screen shots.

I don't profess to have any answers here. There have been many discussions over the years about themes and fonts and scaling and so forth. A quick search will reveal many entries on the subject. But it is something to be aware of and plan for.

One thing that makes it easier in Delphi 2006 and newer are two new components, TFlowPanel and TGridPanel. With TFlowPanel, your controls automatically wrap as the screen gets narrower. If you want more control than that, use TGridPanel where you specify how many rows and columns make up an invisible grid on the panel and the controls stay within those boundaries.

By the way, the code used to display the widths in the above Delphi program is right here:

procedure TfrmWidthTest.ReportWidth;
begin
  StatusBar.Panels[0].Text := 'Width: ' + IntToStr(Width);
  StatusBar.Panels[1].Text := 'ClientWidth: ' + IntToStr(ClientWidth);
  StatusBar.Panels[2].Text := 'CmbWidth: ' + IntToStr(ComboBox.Width);
 
  sbSystem.Panels[0].Text := 'DlgWidth: ' + IntToStr(GetSystemMetrics(SM_CXDLGFRAME));
  sbSystem.Panels[1].Text := 'BorderWidth: ' + IntToStr(GetSystemMetrics(SM_CXBORDER));
  sbSystem.Panels[2].Text := 'EdgeWidth: ' + IntToStr(GetSystemMetrics(SM_CXEDGE));
end;

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • You can use context links in the text to create context-related links to pages or sites that provide additional information about a word or phrase.
  • Scripture references will be linked automatically to an online Bible. E.g. John 3:16, Eph 2:8-9 (ESV).
  • You may link to webpages through the weblinks registry

More information about formatting options

Powered by Drupal. CrystalX theme created by Nuvio | Webdesign.