Advertisement
6_2008-2009 Miscellaneous #197743

Center Text in the Windows Titlebar

This code will read the active titlebar height and font parameters. The Caption of the window is then centered with the date and time. I looked long and hard to try to do this. Most PC's don't use a proportional font for the titlebar and thus the amount of characters displayed depend on the size of the character (i.e. "WWWWWWWWWW" is wider than "llllllllll" in most non-proportional fonts). I found some info on the web and modified it to allow the caption to be centered in the area between the titlebar bitmap and the 3 controlboxes. The Titlebar size and the titlebar font & size can be different from machine to machine. These settings affect how much data can be displayed in the caption of the window, as does the screen resolution. I had originally tried constants based on the form width, but these were not 100%. Try changing the form size and the active title bar settings to see it in operation.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Upload
Original Comments (3)
Recovered from Wayback Machine