КАТЕГОРИИ: Архитектура-(3434)Астрономия-(809)Биология-(7483)Биотехнологии-(1457)Военное дело-(14632)Высокие технологии-(1363)География-(913)Геология-(1438)Государство-(451)Демография-(1065)Дом-(47672)Журналистика и СМИ-(912)Изобретательство-(14524)Иностранные языки-(4268)Информатика-(17799)Искусство-(1338)История-(13644)Компьютеры-(11121)Косметика-(55)Кулинария-(373)Культура-(8427)Лингвистика-(374)Литература-(1642)Маркетинг-(23702)Математика-(16968)Машиностроение-(1700)Медицина-(12668)Менеджмент-(24684)Механика-(15423)Науковедение-(506)Образование-(11852)Охрана труда-(3308)Педагогика-(5571)Полиграфия-(1312)Политика-(7869)Право-(5454)Приборостроение-(1369)Программирование-(2801)Производство-(97182)Промышленность-(8706)Психология-(18388)Религия-(3217)Связь-(10668)Сельское хозяйство-(299)Социология-(6455)Спорт-(42831)Строительство-(4793)Торговля-(5050)Транспорт-(2929)Туризм-(1568)Физика-(3942)Философия-(17015)Финансы-(26596)Химия-(22929)Экология-(12095)Экономика-(9961)Электроника-(8441)Электротехника-(4623)Энергетика-(12629)Юриспруденция-(1492)Ядерная техника-(1748) |
Const
Colors: array [0..6] of TColor = (clYellow, clBlue, clGreen, clRed, clTeal, clPurple, clLime);
ColStr: array[0..6] of string = ('Yellow', 'Blue', 'Green’, 'Red', 'Teal’, 'Purple', 'Lime'); var DockWindows: array[0..6] of TDockableForm; procedure TMainForm. FormCreate (Sender: TObject); var I: Integer; begin for I:= 0 to High(DockWindows) do begin DockWindows[I]:= TDockableForm.Create(Application); DockWindows[I].Caption:= ColStr[I]; DockWindows[I].Memo1.Color:= Colors[I]; DockWindows[I].Memo1.Font.Color:= Colors[I] xor $00FFFFFF; DockWindows[I].Memo1.Text:=ColStr[I] + ' window'; end; end; procedure TMainForm.ShowDockPanel (APanel: TPanel; MakeVisible: Boolean; Client: TControl); begin if not MakeVisible and (APanel.VisibleDockClientCount > 1) then Exit; if APanel = LeftDockPanel then VSplitter.Visible:= MakeVisible else HSplitter.Visible:= MakeVisible; if MakeVisible then if Apanel = LeftDockPanel then begin APanel.Width:= ClientWidth div 3; VSplitter.Left:= APanel.Width + VSplitter.Width; End else begin APanel.Height:= ClientHeight div 3; HSplitter.Top: = ClientHeight - APanel.Height - HSplitter.Width; end else if APanel = LeftDockPanel then APanel.Width:= 0 else APanel.Height:= 0; if MakeVisible and (Client <> nil) then Client.Show; end; procedure TMainForm.ViewToolBar1Execute (Sender: TObject); begin ToolBar1l.Checked:= not ToolBar1l.Checked; btnToolBar1.Down:= ToolBar1l.Checked; if ToolBar1.Floating then ToolBar1.HostDockSite.Visible:= ToolBar1l.Checked else ToolBar1.Visible:= ToolBar1l.Checked; end; procedure TMainForm.ViewToolBar2Execute (Sender: TObject); begin ToolBar21.Checked:= not ToolBar21.Checked; btnToolBar2.Down:= ToolBar21.Checked; if ToolBar2.Floating then TToolDockForm(ToolBar2.HostDockSite).Visible:= ToolBar21.Checked else ToolBar2.Visible:= ToolBar21.Checked; end; procedure TMainForm.ExitActionExecute (Sender: TObject); begin Close; end; procedure TMainForm.ViewClientWindowExecute (Sender: TObject); var DockWindow: TDockableForm; begin DockWindow:= DockWindows[(Sender as TComponent).Tag]; with DockWindow do if HostDockSite is TPageControl then TTabDockHost(HostDockSite.Owner).Show else if (HostDockSite is TConjoinDockHost) and not HostDockSite.Visible then begin HostDockSite.Show; DockWindow.Show; end else if (HostDockSite is TPanel) and (((HostDockSite.Height = 0) or (HostDockSite.Width = 0)) then MainForm.ShowDockPanel( HostDockSite as TPanel, True, DockWindow) else DockWindow.Show; end; procedure TMainForm.CoolBar1DockOver (Sender: TObject; Source: TDragDockObject; X, Y: Integer; State: TDragState; var Accept: Boolean); var ARect: TRect; begin Accept:= (Source.Control is TToolBar); if Accept then begin ARect.TopLeft:= CoolBar1.ClientToScreen( CoolBar1.ClientRect.TopLeft); ARect.BottomRight:= CoolBar1.ClientToScreen( CoolBar1.ClientRect.BottomRight); Source.DockRect:= ARect; end; end; procedure TMainForm.LeftDockPanelDockOver (Sender: TObject; Source: TDragDockObject; X, Y: Integer; State: TDragState; var Accept: Boolean); var ARect: TRect; begin Accept:= Source.Control is TDockableForm; if Accept then begin ARect.TopLeft:= LeftDockPanel.ClientToScreen(Point(0, 0)); ARect.BottomRight:= LeftDockPanel.ClientToScreen( Point(Self.ClientWidth div 3, LeftDockPanel.Height)); Source.DockRect:= ARect; end; end; procedure TMainForm.LeftDockPanelDockDrop(Sender: TObject; Source: TDragDockObject; X, Y: Integer); begin if (Sender as TPanel).DockClientCount = 1 then ShowDockPanel(Sender as TPanel, True, nil)? (Sender as TPanel).DockManager.ResetBounds(True); end; procedure TMainForm. LeftDockPanelUnDock(Sender: TObject; Client: TControl; NewTarget: TWinControl; var Allow: Boolean); begin if (Sender as TPanel).DockClientCount = 1 then ShowDockPanel(Sender as TPanel, False, nil); end; procedure TMainForm. LeftDockPanelGetSitelnfо (Sender: TObject; DockClient: TControl; var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean); begin CanDock:=DockClient is TDockableForm; end; procedure TMainForm.BottomDockPanelDockOver(Sender: TObject; Source: TDragDockObject; X, Y: Integer; State: TDragState; var Accept: Boolean); var ARect: TRect; begin Accept:= Source.Control is TDockableForm; if Accept then begin ARect.TopLeft:= BottomDockPanel.ClientToScreen( Point(0, -Self.ClientHeight div 3)); ARect.BottomRight:=BottomDockPanel.ClientToScreen( Point(BottomDockPanel.Width, BottomDockPanel.Height)); Source.DockRect:= ARect; end; end;
Дата добавления: 2014-12-29; Просмотров: 367; Нарушение авторских прав?; Мы поможем в написании вашей работы! Нам важно ваше мнение! Был ли полезен опубликованный материал? Да | Нет |