Friday 19 October 2012

How to put a single line border around a form

Recently I wanted to put a single line border around a form without having a title bar. The way I solved the problem was to set the border style to bsNone and put the following in the OnPaint event of the form.


var
    YFrame: Integer;
    Rect  : TRect;
begin
    inherited;
    if not(fsModal in FormState) then
    begin
        YFrame      := 1;
        Rect.Left   := 0;
        Rect.Top    := 0;
        Rect.Right  := Width;
        Rect.Bottom := Height;

        Canvas.Handle      := GetWindowDC(Handle);
        Canvas.Brush.Color := clBlack;
        Canvas.Brush.Style := bsSolid;
        Canvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, YFrame);
        Canvas.Rectangle(Rect.Left, Rect.Top, YFrame, Rect.Bottom);
        Canvas.Rectangle(Rect.Right - YFrame, Rect.Top, Rect.Right, Rect.Bottom);
        Canvas.Rectangle(Rect.Left, Rect.Bottom - YFrame, Rect.Right, Rect.Bottom);
    end;
end;


Thursday 11 October 2012

How to remove EurekaLog's update message


If you use Delphi and EurekaLog to record information on errors, there is an annoying message that appears every time you open Delphi about going to the EurekaLog web site and updating the software. To remove the message change the following EurekaLog.ini file setting to this:

[IDE]
CanCheckUpdates=0

This file exists in the following directories:


C:\Windows\EurekaLog.ini
C:\Users\<youraccount>\AppData\Roaming\EurekaLog\EurekaLog.ini

Delphi Bar

This blog is all about software development and in particular the Delphi programming language. I have been developing software for 15 years and the main development environment I have used is Delphi. I have developed all types of software from client server applications to web services and even web sites using Delphi.