Вниз
Скачать: CL | DM;

MDIForm without scrollbars   Найти похожие ветки 

 
Smok_er   (2003-01-07 20:54) [0]

Мастера!
При использовании MDI при невлезании MDIChild"ов у основного окна появляются скроллеры.
Как от них избавиться?


 
Song ©   (2003-01-07 21:21) [1]


{ Избавление от ScrollBar"ов в MDI-форме. (С) Peter Below (TeamB) }
{ Не надо VCL переписывать :-) }

unit MainForm;

interface

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

type
TfMain = class(TForm)
MainMenu1: TMainMenu;
Newchild1: TMenuItem;
Newchild2: TMenuItem;
procedure Newchild2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
fMain: TfMain;

implementation

uses ChildForm;

{$R *.DFM}

procedure TfMain.Newchild2Click(Sender: TObject);
begin
with TfChild.Create(Application) do
Show();
end;

function ClientWindowProc( wnd: HWND; msg: Cardinal; wparam, lparam: Integer ): Integer; stdcall;
var
f: Pointer;
begin
f := Pointer( GetWindowLong( wnd, GWL_USERDATA ));
case msg of
WM_NCCALCSIZE:
if ( GetWindowLong( wnd, GWL_STYLE ) and
(WS_HSCROLL or WS_VSCROLL)) <> 0 then
SetWindowLong( wnd, GWL_STYLE, GetWindowLong( wnd, GWL_STYLE )
and not (WS_HSCROLL or WS_VSCROLL));
end;
Result := CallWindowProc( f, wnd, msg, wparam, lparam );
end;

procedure TfMain.FormCreate(Sender: TObject);
begin
if ClientHandle <> 0 then begin
if GetWindowLong( ClientHandle, GWL_USERDATA ) <> 0 then
Exit; {cannot subclass client window, userdata already in use}
SetWindowLong(ClientHandle, GWL_USERDATA, SetWindowLong( ClientHandle,
GWL_WNDPROC, integer( @ClientWindowProc)));
end;

end;

end.


 
Оливейра ©   (2003-01-07 21:50) [2]

Какой хакерский код :-)

А кто такой ClientHandle? :)

Уй мама рОдная :-) А нахрена в WndProc лезть-то, а?
procedure CalcSize(var Msg: TMessage); message WM_NCCALCSIZE; в клиенте назначить?


 
Song ©   (2003-01-07 21:56) [3]

Ну попробуй.. попробуй.. умник нашёлся.. :-)


 
Song ©   (2003-01-07 21:58) [4]

RTFM, товарищ!

Provides access to the handle of the form’s internal MDI client window.

property ClientHandle: HWND;

Description

Use ClientHandle to get the handle for the form’s internal MDI client window.

ClientHandle is meaningful only if the form is an MDI parent (that is, if the form’s FormStyle property is set to fsMDIForm).

Note: Use the Handle property instead to get the handle to the form window itself.


 
Оливейра ©   (2003-01-07 22:47) [5]

Ай, да, век живи век учись :-)


 
Song ©   (2003-01-07 22:50) [6]

2Оливейра © (07.01.03 22:47)
Ну чего получилось поймать WM_NCCALCSIZE, описав его в классе? :-)))


 
Diamond Cat ©   (2003-01-08 00:02) [7]

а через ShowScrollBar не проще?


 
Smok_er   (2003-01-08 00:53) [8]

Diamond Cat © (08.01.03 00:02)
а через ShowScrollBar не проще?
Попробуй, авось и получится. У меня к сожалению не получилось :(

Огромнейшее спасибо!
А может кто-нибудь дать ссылки на доки по работе с MDI? Т.е. интересует, как избавляться от Caption"a дочерней формы в заглавной и т.д. без правки VCL.



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

Скачать: CL | DM;



Память: 0.47 MB
Время: 0.01 c
3-52807
fofa
2003-01-31 18:42
2003.02.17
Как в одном SQL-запросе задействовать две базы данных(+)


14-53262
vic_774N
2003-02-01 23:36
2003.02.17
Человеки ! Очень нужен rtl60.bpl !!!


1-53083
andrei
2003-02-06 19:06
2003.02.17
Delphi 6 можно из Imedg сохранить в gif формат


14-53273
Карлсон
2003-02-02 00:27
2003.02.17
забавный сегодня день - 01.02.03 :)


1-53061
jiura
2003-02-06 17:11
2003.02.17
Скрытие MDiChild




   Наверх