2007. január 6., szombat
Create a scrollbox that lets you disable automatic scrolling
Problem/Question/Abstract:
How to create a scrollbox that lets you disable automatic scrolling
Answer:
unit MyScrollBox;
interface
uses
SysUtils, Classes, Controls, Forms;
type
TMyScrollBox = class(TScrollBox)
private
FEnableScrollInView: Boolean;
protected
procedure AutoScrollInView(AControl: TControl); override;
public
constructor Create(AOwner: TComponent); override;
published
property EnableScrollInView: Boolean read FEnableScrollInView
write FEnableScrollInView default True;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMyScrollBox]);
end;
procedure TMyScrollBox.AutoScrollInView(AControl: TControl);
begin
if FEnableScrollInView then
inherited AutoScrollInView(AControl);
end;
constructor TMyScrollBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEnableScrollInView := True;
end;
end.
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése