Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.08.20;
Скачать: CL | DM;

Вниз

Компонент: панель с кнопками открытых MDI окон.   Найти похожие ветки 

 
Oleon   (2006-07-06 15:52) [0]

На главной форме, внизу рисуется панелька...

Подскажите, пожалуйста, кто знает такие компоненты. Я знаю, что они есть, но не помню как называются...

спасибо.


 
PSPF2003 ©   (2006-07-06 16:01) [1]

А самому сделать?


 
PSPF2003 ©   (2006-07-06 16:06) [2]

Кстати есть компонент могу дать.


 
Eraser ©   (2006-07-06 16:06) [3]

> [0] Oleon   (06.07.06 15:52)

у Gero есть :)


 
PSPF2003 ©   (2006-07-06 16:09) [4]


> у Gero есть :)

Хм... У меня тоже есть :)


 
Игорь Шевченко ©   (2006-07-06 16:14) [5]


> Я знаю, что они есть, но не помню как называются


ElegantMDI ?


 
Oleon   (2006-07-06 16:25) [6]

самому писать это время надо))

то PSPF2003 - если дашь компонент скажу БОЛЬШОЕ СПАСИБО.)

ElegantMDI - только что поставил... разбираюсь... но не могу найти у него свойство, чтобы он не сварачивался... а то мышкой пока наведешь, пока он всплывет время проходит и не очень удобно... так я и в меню посмтрю открытые окна...


 
Oleon   (2006-07-06 16:26) [7]

а Gero это кто или что?)


 
PSPF2003 ©   (2006-07-06 16:42) [8]

www.Pspf2003.narod.ru/MDITAB.rar

189 902 байт

Скачен с Torry


 
Phoroon~ ©   (2006-07-06 16:57) [9]

Ой, этот "ElegantMDI" так лажево сделан.

ИМХО
Отстой полный.


 
Oleon   (2006-07-06 17:07) [10]

СПАСИБО БОЛЬШОЕ!!!))


 
ancot   (2006-07-07 13:25) [11]

Писал года 4 назад, вроде сносно работает.

interface

uses
Windows ,SysUtils, Classes, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Types, Menus, Messages;

type
TWndPanel = class(TCustomControl)
private
  CanDraw: Boolean;
  FAutoHide: Boolean;
  FChildCount: Integer;
  FActiveForm: Integer;
  FIcon: TIcon;
  FBmp: TBitmap;
  FImage: TImageList;
  FImageIndex: Integer;
  function BtnRect(Index: Integer): TRect;
  function GetChild(Index: Integer): TForm;
  procedure SetAutoHide(Value: Boolean);
  procedure CMMouseEnter (var Message: TMessage); message CM_MOUSEENTER;
  procedure CMMouseLeave (var Message: TMessage); message CM_MOUSELEAVE;
protected
  procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
    X, Y: Integer); override;
public
  procedure FormChange(Sender: TObject);
  constructor Create(AOwner: TComponent); override;
  destructor Destroy; override;
  procedure Paint; override;
  procedure Loaded; override;
published
  property Visible;
  property Color;
  property Image: TImageList read FImage write FImage;
  property ImageIndex: Integer read FImageIndex write FImageIndex;
  property AutoHide: Boolean read FAutoHide write SetAutoHide;
  property PopupMenu;
end;

procedure Register;

implementation

{$R ICO.RES}

uses Math;

constructor TWndPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FBmp := TBitmap.Create;
Align := alBottom;
Color := clBtnFace;
FIcon := TIcon.Create;
FIcon.Transparent := true;
FIcon.Width := 16;
FIcon.Height := 16;
end;

destructor TWndPanel.Destroy;
begin
FBmp.Free;
FIcon.Free;
inherited Destroy;
end;

procedure TWndPanel.Paint;
var R: TRect;
    n, i: Integer;
    Cap: String;
    Ico: TIcon;
    Frm: TComponent;
begin
with Canvas, Application do
begin
  Brush.Color := clBtnFace;
  FillRect(BoundsRect);
  R := Rect(0, Height - 1, Width + 1, Height - 1);
  Frame3D(Canvas, R, clWhite, clBtnShadow, 1);
  if (csDesigning in componentstate) or (FChildCount = 0) or (not CanDraw) then Exit;
  n:= 0;
  for i := 0 to ComponentCount - 1 do
  begin
    Frm := Components[i];
    if (Frm is TForm) and (TForm(Frm).FormStyle = fsMDIChild) then
    begin
      Frm := Components[i] as TForm;
      R := BtnRect(n);
      FillRect(R);
      if Frm = MainForm.ActiveMDIChild then
      begin
        Font.Style := [fsBold];
        Frame3D(Canvas, R, cl3DDkShadow, clWhite, 1);
        Frame3D(Canvas, R, clBtnShadow, clBtnFace, 1);
        FActiveForm := n;
        R.Right := R.Left + 16;
      end else
      begin
        Font.Style := [];
        Frame3D(Canvas, R, clWhite, cl3DDkShadow, 1);
        Frame3D(Canvas, R, clBtnFace, clBtnShadow, 1);
        R.Right := R.Left + 16;
        OffsetRect(R, -1, -1);
      end;
      Brush.Color := clBtnFace;
      Ico := TForm(Frm).Icon;
      if Ico.Empty then
      begin
        if Image <> nil then
          Image.GetIcon(ImageIndex, FIcon);
      end else
      begin
        if Assigned(Ico) then FIcon.Assign(Ico);
      end;
      Draw(R.Left, R.Top, FIcon);
      R := BtnRect(n);
      Inc(R.Left, 21);
      Inc(R.Top, 3);
      Dec(R.Right, 2);
      Cap :=  TForm(Frm).Caption;
      DrawText(Canvas.Handle, PChar(Cap), Length(Cap), R, DT_LEFT or DT_END_ELLIPSIS);
      Inc(n);
    end;
  end;
end;
end;

procedure TWndPanel.Loaded;
begin
inherited Loaded;
Height := 24;
if not (csDesigning in Componentstate) then
  Screen.OnActiveFormChange :=  FormChange;
end;

procedure TWndPanel.SetAutoHide(Value: Boolean);
begin
FAutoHide := Value;
if FAutoHide then Height := 6
             else Height := 24;
CanDraw := not Value;
end;

function TWndPanel.GetChild(Index: Integer): TForm;
var n, i: Integer;
begin
n := 0;
Result := nil;
for i := 0 to Application.ComponentCount - 1 do
  if Application.Components[i] is TForm then
    if (Application.Components[i] as TForm).FormStyle = fsMDIChild
     then begin
            if n = Index then
            begin
              Result := TForm(Application.Components[i]);
              Exit;
            end;
            Inc(n);
          end;
end;

function TWndPanel.BtnRect(Index: Integer): TRect;
var BtnWidth: Integer;
begin
BtnWidth := Min(170, Width div FChildCount);
Result := Rect(Index * BtnWidth, 1, Index * BtnWidth + BtnWidth - 3, Height - 3)
end;

procedure TWndPanel.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
var i: Integer;
    R: TRect;
begin
inherited;
if not (ssLeft in Shift) then Exit;
for i := 0 to Application.MainForm.MDIChildCount - 1 do
begin
  R := BtnRect(i);
  if (X >= R.Left) and (X <= R.Right)
    and (Y >= R.Top) and (Y <= R.Bottom) then GetChild(i).Show;
end;
end;

procedure TWndPanel.FormChange(Sender: TObject);
begin
with Application do
begin
  if (Terminated or not Visible) or (MainForm = nil) then Exit;
  FChildCount := MainForm.MDIChildCount;
end;
Invalidate;
end;

procedure TWndPanel.CMMouseEnter (var Message: TMessage);
begin
inherited;
if csDesigning in ComponentState then Exit;
if (GetActiveWindow <> 0) then
  if FAutoHide then
  begin
    CanDraw := true;
    Height := 24;
  end;
end;

procedure TWndPanel.CMMouseLeave (var Message: TMessage);
begin
inherited;
if csDesigning in componentstate then Exit;
  if FAutoHide then
  begin
    CanDraw := False;
    Height := 6;
    Repaint;
  end;
end;

procedure Register;
begin
RegisterComponents("1C Controls", [TWndPanel]);
end;

end.



Страницы: 1 вся ветка

Текущий архив: 2006.08.20;
Скачать: CL | DM;

Наверх




Память: 0.51 MB
Время: 0.033 c
2-1154501900
Arsenija
2006-08-02 10:58
2006.08.20
обработка по нажатии ENTER в LabeledEdit


15-1153770856
palva
2006-07-24 23:54
2006.08.20
Активный отдых в Подмосковье


1-1152207760
Andy BitOff
2006-07-06 21:42
2006.08.20
Вывод текста.


11-1131530297
algambra
2005-11-09 12:58
2006.08.20
Совместное исп. KOL and VCL


15-1153430033
QuickFinder
2006-07-21 01:13
2006.08.20
Игры на ZX-Spectrum: Back To Skool