A
ak_2004
Unregistered / Unconfirmed
GUEST, unregistred user!
我现在需要给Panel加上滚动条,不要告诉我用ScrollBox.因为我现在需要改原来的程序,但不改控件。
我现在通过覆盖TPanel的CreateParams方法已经给Panel加上了滚动条,但是该滚动条还不能滚动,请问如何才能实现该功能,请指点。
我的测试代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TPanel =class(ExtCtrls.TPanel)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
TForm1 = class(TForm)
Panel1: TPanel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TPanel }
procedure TPanel.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
Style :=Style or WS_HSCROLL or WS_VSCROLL;
end;
end.
我现在通过覆盖TPanel的CreateParams方法已经给Panel加上了滚动条,但是该滚动条还不能滚动,请问如何才能实现该功能,请指点。
我的测试代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TPanel =class(ExtCtrls.TPanel)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
TForm1 = class(TForm)
Panel1: TPanel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ TPanel }
procedure TPanel.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
Style :=Style or WS_HSCROLL or WS_VSCROLL;
end;
end.