IS THE TASKBAR ALLWAYS ON TOP?
// ******************************************************************
// IS THE TASKBAR ALLWAYS ON TOP?
// Category : Task
// Author : ZieglerSoft
// Author Email :
// Author Web : http://www.zieglersoft.dk/includes/usercount.asp
// Tips Website : DelphiTips.com
// Tips Website URL: http://www.delphitips.com
// ******************************************************************
Uses
ShellApi;
Function IsTaksBarAllwaysOnTop:Boolean;
Var
AB : TAppBarData;
Begin
AB.cbSize := sizeof(AB);
Result :=(SHAppBarMessage(ABM_GETSTATE, AB)and ABS_ALWAYSONTOP) > 0;
End;
SETTING UP THE MDI PARENT WINDOW CORRECTLY
// ******************************************************************
// SETTING UP THE MDI PARENT WINDOW CORRECTLY
// Category : MDI
// Author : Michael Burton
// Author Email :
// Author Web : http://www.rimrocksoftware.com/tips.html
// Tips Website : Rimrock Software
// Tips Website URL: http://www.rimrocksoftware.com/tips.html
// ******************************************************************
{
Delphi does not set up the MDI parent window correctly. Use the following to set
the proper border for the MDI parent window.
}
SetWindowLong(ClientHandle, GWL_EXSTYLE, WS_EX_CLIENTEDGE);
SetWindowPos(ClientHandle, HWND_BOTTOM, 0,0,0,0,SWP_NOCOPYBITS);
// (From Russ Reese)
CLOSE A MDICHILD FORM
// ******************************************************************
// CLOSE A MDICHILD FORM
// Category : MDI
// Author : Carlos Borrero
// Author Email : cbarrer@elsitio.net.co
// Author Web :
// Tips Website : Swiss Delphi Center
// Tips Website URL: http://www.swissdelphicenter.ch
// ******************************************************************
unit Child;
// Have you noticed that when you try to close a MDIChild form
// the form minimizes but doesn’t disappear from your Main form
// client area?
//
// With this tip you can learn how to really close the MDI child
// form and free the memory occupied by the form
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TMDIChildForm = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MDIChildForm: TMDIChildForm;
implementation
{$R *.DFM}
procedure TMDIChildForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
// This line of code frees memory and closes the form
Action := caFree;
end;
end.
TOOLTIP FONT HINT PROPERTIES
// ******************************************************************
// TOOLTIP FONT HINT PROPERTIES
// Category : Hint/ToolTip
// Author : Zarko Gajic
// Author Email : delphi.guide@about.com
// Author Web : http://www.delphi.about.com
// Tips Website : About Delphi Pages
// Tips Website URL: http://www.delphi.about.com
// ******************************************************************
{Change the font in Tool Tip (Hint box)}
Type
TMyHintWindow = Class (THintWindow)
Constructor Create (AOwner: TComponent);override;
end;
Constructor TMyHintWindow.Create(AOwner:TComponent);
begin
Inherited Create (AOwner);
Canvas.Font.Name := ‘Courier New’;
Canvas.Font.Size := 72;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint := false;
HintWindowClass := TMyHintWindow;
Application.ShowHint := True;
end;
MULTILINES HINT
// ******************************************************************
// MULTILINES HINT
// Category : Hint/ToolTip
// Author : Greatis Software
// Author Email :
// Author Web : www.greatissoftware.com
// Tips Website : Greatis Software
// Tips Website URL: http://www.greatis.com/delphi/tips.html
// ******************************************************************
{
Creating multiline hint is not so difficult. Set ShowHint of Button1 to True and
try this:
}
procedure TForm1.FormCreate(Sender: TObject);
begin
Button1.Hint:=’Greatis’+#13+’Delphi Pages’;
end;
MORE LINES IN A HINT
// ******************************************************************
// MORE LINES IN A HINT
// Category : Hint/ToolTip
// Author : Studiebureau Festraets
// Author Email :
// Author Web : http://www.festra.com/eng/index.html
// Tips Website : Delphi Land
// Tips Website URL: http://www.festra.com/eng/index.html
// ******************************************************************
{
If you want to display more than a one line in the hint of a component, for
example of Button1, set it’s property ShowHint to true. In the Object Inspector,
don’t put anything in Button1’s hint property.
In the FormCreate event handler of the form that contains Button1, add this line:
Button1.Hint := ‘First line’ + Chr(13) + ‘Second line’;
}
CREATE YOUR OWN HINTS
// ******************************************************************
// CREATE YOUR OWN HINTS
// Category : Hint/ToolTip
// Author : Domas Savickas
// Author Email : domass@takas.lt
// Author Web : http://ddelphi.hypermart.net/delphi
// Tips Website : Domas Delphi Pages
// Tips Website URL: http://ddelphi.hypermart.net/delphi
// ******************************************************************
{
If you don’t quite like the way how Delphi’s default hints look like,
you can use THintWindow component to create your own customized hint window.
Here’s an example:
}
var
h : THintWindow;
r : TRect;
begin
with r do
begin
//
// set the position and size
// of the hint window
//
left := 10;
top := 50;
right := 200;
bottom := 100;
end;
h := THintWindow.Create( Self );
with h do
begin
//
// set the background color
//
Color := clRed;
ActivateHint( r, ‘hi there!’ );
//
// perform your tasks here
// before closing the hint window
//
MessageBox( 0,
‘Press any key to close the ‘
+ ‘hint window’,
‘THintWindow’,
MB_OK );
ReleaseHandle;
Free;
end;
end;
CREATE A NONSTANDARD REGION OF HINT
// ******************************************************************
// CREATE A NONSTANDARD REGION OF HINT
// Category : Hint/ToolTip
// Author : Greatis Software
// Author Email :
// Author Web : www.greatissoftware.com
// Tips Website : Greatis Software
// Tips Website URL: http://www.greatis.com/delphi/tips.html
// ******************************************************************
{
First of all, you should create a new class with ActiveHint procedure. When you
create form, you should set HintWindowClass to your new class (TMyHint).
Try this:
}
TMyHint = class(THintWindow)
private
FRegion: THandle;
public
procedure ActivateHint(Rect: TRect; const AHint: string); override;
end;
// …
procedure TMyHint.ActivateHint(Rect: TRect; const AHint: string);
begin
SetWindowRgn(Handle, 0, True);
DeleteObject(FRegion);
BoundsRect:=Rect;
FRegion:=CreateEllipticRgn(0,0,Width,Height);
SetWindowRgn(Handle, FRegion, True);
inherited ActivateHint(Rect, AHint);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint:=False;
HintWindowClass:=TMyHint;
Application.ShowHint:=True;
end;
-
Archives
- November 2007 (8)
- October 2007 (32)
-
Categories
-
RSS
Entries RSS
Comments RSS