Статьи по Delphi (009)…
Скрыть окна IDE во время проектирования.
Оформил: DeeCo Автор: http://www.swissdelphicenter.ch
//****************************************
// Paste into AutoHideIDE.dpk
//****************************************
package AutoHideIDE;
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESIGNONLY}
{$IMPLICITBUILD OFF}
requires
rtl,
vcl;
contains
AutoHide in 'AutoHide.pas';
end.
//****************************************
// Paste into AutoHide.pas
//****************************************
unit AutoHide;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Forms;
type
TAutoHider = class(TObject)
protected
procedure DelphiOnMessage(var Msg: TMsg; var Handled: Boolean);
procedure MyDockDrop(Sender: TObject; Source: TDragDockObject; X, Y: Integer);
procedure MyDestroy(Sender: TObject);
public
OldDockDrop: TDockDropEvent;
OldDestroy: TNotifyEvent;
Delphi: TApplication;
Bar_Top: TForm;
Bar_Left: TForm;
ObjInspector: TForm;
DockHost: TForm;
Bar_Top_Rect: TRect;
Bar_Left_Rect: TRect;
F_AtTop: Boolean;
F_AtLeft: Boolean;
procedure Init_Bar_Left;
procedure Bar_Left_Visible(val: Boolean);
procedure Bar_Top_Visible(Value: Boolean);
end;
var
AutoHider: TAutoHider;
implementation
{ TAutoHide }
procedure Restore_Bar_Left;
begin
AutoHider.ObjInspector.OnDockDrop := nil;
if AutoHider.DockHost <> nil then
begin
AutoHider.DockHost.OnDestroy := nil;
end;
AutoHider.Bar_Left.BoundsRect := AutoHider.Bar_Left_Rect;
end;
procedure Restore_Bar_Top;
begin
AutoHider.Bar_Top.BoundsRect := AutoHider.Bar_Top_Rect;
end;
procedure InitAutoHider(Value: Boolean);
begin
if Value then
begin
AutoHider.Delphi := Application;
AutoHider.Bar_Top := TForm(Application.FindComponent('AppBuilder'));
if AutoHider.Bar_Top <> nil then
begin
AutoHider.Bar_Top_Rect := AutoHider.Bar_Top.BoundsRect;
AutoHider.ObjInspector := AutoHider.Bar_Top.FindComponent('PropertyInspector')
as TForm;
AutoHider.Bar_Left_Rect := AutoHider.ObjInspector.BoundsRect;
AutoHider.OldDockDrop := AutoHider.ObjInspector.OnDockDrop;
AutoHider.ObjInspector.OnDockDrop := AutoHider.MyDockDrop;
AutoHider.DockHost := nil;
AutoHider.Init_Bar_Left;
AutoHider.F_AtTop := True;
AutoHider.F_AtLeft := True;
AutoHider.Delphi.OnMessage := AutoHider.DelphiOnMessage;
end;
end
else
begin
Restore_Bar_Left;
Restore_Bar_Top;
end;
end;
procedure TAutoHider.Bar_Top_Visible(Value: Boolean);
begin
if Value = F_AtTop then Exit;
if Value then
begin
Bar_Top.Top := 0;
Bar_Top.Show;
end
else
begin
Bar_Top.Top := -Bar_Top.Height + 3;
end;
F_AtTop := Value;
end;
procedure TAutoHider.Bar_Left_Visible(val: Boolean);
begin
if val = F_AtLeft then Exit;
if val then
begin
Bar_Left.Left := 0;
Bar_Left.Top := 0;
Bar_Left.Height := Screen.WorkAreaHeight;
Bar_Left.Show;
end
else
begin
Bar_Left.Left := -Bar_Left.Width + 3;
end;
F_AtLeft := val;
end;
procedure TAutoHider.DelphiOnMessage(var Msg: TMsg; var Handled: Boolean);
begin
if not Delphi.Active then Exit;
if (Msg.message = WM_LBUTTONDOWN) then Exit;
if (Msg.message = WM_MOUSEMOVE) or (Msg.message = WM_NCMOUSEMOVE) then
begin
if F_AtTop then
if Mouse.CursorPos.Y > Bar_Top.Height + 50 then
begin
Bar_Top_Visible(False);
end;
if not F_AtTop then
if Mouse.CursorPos.Y < 3 then
begin
Bar_Top_Visible(True);
end;
if F_AtLeft then
if (Mouse.CursorPos.x > Bar_Left.Width + 50) and (not Bar_left.Active) then
begin
Bar_Left_Visible(False);
end;
if not F_AtLeft then
if Mouse.CursorPos.X < 3 then
begin
Bar_Left_Visible(True);
end;
end;
end;
procedure TAutoHider.MyDestroy(Sender: TObject);
begin
if Sender is TApplication then
begin
Bar_Top_Visible(False);
Bar_Left_Visible(False);
end
else
begin
if Assigned(OldDestroy) then OldDestroy(Sender);
DockHost := nil;
Bar_Left := ObjInspector;
end;
end;
procedure TAutoHider.Init_Bar_Left;
begin
if (Delphi.FindComponent('TabDockHostForm') as TForm) <> nil then
DockHost := Delphi.FindComponent('TabDockHostForm') as TForm
else if (Delphi.FindComponent('JoinDockForm') as TForm) <> nil then
DockHost := Delphi.FindComponent('JoinDockForm') as TForm;
if DockHost <> nil then
begin
DockHost.Top := 0;
DockHost.Height := Screen.WorkAreaHeight;
OldDestroy := DockHost.OnDestroy;
DockHost.OnDestroy := MyDestroy;
Bar_Left := DockHost;
end
else
begin
Bar_Left := ObjInspector;
end;
end;
procedure TAutoHider.MyDockDrop(Sender: TObject; Source: TDragDockObject; X,
Y: Integer);
begin
if Assigned(OldDockDrop) then OldDockDrop(Sender, Source, X, Y);
Init_Bar_Left;
end;
initialization
AutoHider := TAutoHider.Create;
InitAutoHider(True);
finalization
InitAutoHider(False);
AutoHider.Delphi.OnMessage := nil;
AutoHider.Free;
end.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- 221.
- 222.
- 223.
- 224.
- 225.
- 226.
- 227.
- 228.
- 229.
- 230.
- 231.
- 232.
- 233.
- 234.
- 235.
- 236.
- 237.
- 238.
- 239.
- 240.
- 241.
- 242.
- 243.
- 244.
- 245.
- 246.
- 247.
- 248.
- 249.
- 250.
- 251.
- 252.
- 253.
- 254.
- 255.