MY

xiaoxiao2021-03-06  107

// add multilinepalette function by Luyear 20021101 // address to forbid autohide function by Luyear 20021102Unit my_ide;

Interface

Uses Windows, Messages, Sysutils, Classes, Controls, Forms, Comctrls;

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; ibjinspector: 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; TMultiLinePalette = class // ︽ touch public procedure ResizeComponentPalette (Sender: TObject); end;

Var AutoHider: Tautohider; MultiLinePalette: TmultilinePalette; //   祇 祇 IMplementation

{︽} procedure TMultiLinePalette.ResizeComponentPalette (Sender: TObject); varAHeight: integer; beginwith (Sender as TTabControl) do beginAHeight: = Height DisplayRect.Top - DisplayRect.Bottom 29; Constraints.MinHeight: = AHeight; Parent.Constraints .Maxheight: = ahant; end; end; {resizemultilinecomponentpalette}

procedure SetMultiLineComponentPalette (MultiLine: boolean); varAppBuilder: TForm; TabControl: TTabControl; beginAppBuilder: = TForm (Application.FindComponent ( 'AppBuilder')); if (AppBuilder <> nil) then beginTabControl: = TTabControl (AppBuilder.FindComponent ( 'TabControl ')); if (TabControl <> nil) then beginTabControl.MultiLine: = MultiLine; if MultiLine thenTabControl.OnResize: = MultiLinePalette.ResizeComponentPaletteelseTabControl.OnResize: = nil; end; end; end; {SetMultiLineComponentPalette} {TAutoHide}

Procedure restore_bar_left; begin autohider.objinspector.ondockdrop: = NIL;

IF AutoHider.dockHost <> nil dam 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;

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 dam.

IF value or (bar_top.windowstate = wsmaximized) THEN BAR_TOP.TOP: = 0; bar_top.show; end else begin bar_top.top: = -bar_top.height 3; End;

F_attop: = value;

Procedure tautohider.bar_left_visible (val: boolean); begin if Val = f_atleft kil ixit;

if val OR (Bar_Left.windowstate = wsMaximized) 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 dam; 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 dam bar_top_visible (true);

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;

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 damhost: = 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; // add by Luyear 021104 bar_left.constraints.maxwidth: = 200; bar_left.borderstyle: = bssizeable;

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 MultiLinePalette: = TmultilinePalette.create; SetMultilineComponentpalette (TRUE);

Autohider: = tautohider.create; initautohider (true);

Finalization InIntohider (false); autohider.delphi.onmessage: = nil; autohider.free; setmultilineComponentpalette (false); multilinepalette.free; end.

转载请注明原文地址:https://www.9cbs.com/read-124716.html

New Post(0)