greetings Likvod Systems has been creating bespoke software for the water industry since 1995. The programs are tailor-made to suit your requirements.

Delphi 7 and 125 dots per inch

Recently I was asked to modify a program to cope with screen resolutions higher than the standard 98 dpi. Looking on the net, there were lots of dire warnings, but I spotted something that looked helpful. All I needed to do was to switch auto-scroll off and switch auto-size on for each of the forms. I tried it, but it had unexpected consequences. With auto-size on, it trims all the empty screen area around the controls. The result was that my nicely designed layouts looked fairly aweful and really cramped.

I therefore hit on the idea of placing a label, with the caption “.” in the top left and bottom right of each form. This ensured that all the margins around the bits that mattered were preserved. I could have changed the text colour to be the same as the background colour, but did not bother, as you can barely see the dots.

Resizeable forms

The other unexpected consequence is that the forms are no longer re-sizeable. To resolve this, I had to switch back to auto-scroll on and auto-size off, but only after the form had displayed. To do this I use

   PostMessage (Handle, WM_SCROLOFF, 0, 0)

which is handled by

   procedure TProgEdit.WmScroloff (var mess: Tmessage);
   begin   
   autoscroll := true;   
   sutosize := false;
   progmemo.align := alClient;  
   end;

I use PostMessage to ensure that the form has finished displaying before its attributes are reset. In some instances, I have had to change the alignment of a control from alClient to alLeft, to enable me to place the dot labels correctly, and so the alignment is also reset in WmScroloff.

It works for me, and seemed a lot less complicated than some of the stuff I read. One day, perhaps I will change the text colour of the dots to match the background.

Written by Bob Evens

Bob Evens is the Managing Director of Likvod Systems Ltd, and also serves as its principal engineer. He has a wide base of experience, having studied electrical engineering at Bristol University, and worked for a major supplier of Telemetry systems for twelve years. He programs in Delphi, Pascal, Sercal, Assembler and the odd bit of C and C++. He is also a qualified psychiatric nurse, and leads a local church congregation in Worksop.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.