?? suiscrollbar.pas
字號(hào):
////////////////////////////////////////////////////////////////////////////////
//
//
// FileName : SUIScrollBar.pas
// Creator : Shen Min
// Date : 2003-03-26 V1-V3
// 2003-07-02 V4
// Comment :
//
// Copyright (c) 2002-2003 Sunisoft
// http://www.sunisoft.com
// Email: support@sunisoft.com
//
////////////////////////////////////////////////////////////////////////////////
unit SUIScrollBar;
interface
{$I SUIPack.inc}
uses Windows, ExtCtrls, Classes, Controls, SysUtils, Graphics, Forms, Messages,
SUIProgressBar, SUITrackBar, SUIButton, SUIThemes, SUIMgr;
type
TsuiScrollBar = class(TCustomPanel)
private
m_TrackBar : TsuiScrollTrackBar;
m_Btn1 : TsuiImageButton;
m_Btn2 : TsuiImageButton;
m_SliderLeft : TBitmap;
m_SliderCenter : TBitmap;
m_SliderRight : TBitmap;
m_UIStyle : TsuiUIStyle;
m_FileTheme : TsuiFileTheme;
m_Orientation : TsuiProgressBarOrientation;
m_SmallChange : TScrollBarInc;
m_LineButton: Integer;
procedure SetOrientation(const Value: TsuiProgressBarOrientation);
procedure SetUIStyle(const Value: TsuiUIStyle);
procedure PlaceTrackBarAndButton();
procedure UpdatePictures();
procedure UpdateSliderPic();
function GetMax: Integer;
function GetMin: Integer;
function GetPosition: Integer;
procedure SetMax(const Value: Integer);
procedure SetMin(const Value: Integer);
procedure SetPosition(const Value: Integer);
function GetLargeChange: TScrollBarInc;
procedure SetLargeChange(const Value: TScrollBarInc);
function GetPageSize: Integer;
procedure SetPageSize(const Value: Integer);
function GetSliderVisible: Boolean;
procedure SetSliderVisible(const Value: Boolean);
function GetOnChange: TNotifyEvent;
procedure SetOnChange(const Value: TNotifyEvent);
procedure SetFileTheme(const Value: TsuiFileTheme);
procedure MouseContinuouslyDownDec(Sender : TObject);
procedure MouseContinuouslyDownInc(Sender : TObject);
procedure WMSIZE(var Msg : TMessage); message WM_SIZE;
procedure WMERASEBKGND( var Msg : TMessage); message WM_ERASEBKGND;
procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED;
procedure SetLineButton(const Value: Integer);
function GetLastChange: Integer;
protected
procedure Resize(); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy(); override;
property SliderVisible : Boolean read GetSliderVisible write SetSliderVisible;
property LastChange : Integer read GetLastChange;
published
property FileTheme : TsuiFileTheme read m_FileTheme write SetFileTheme;
property LineButton : Integer read m_LineButton write SetLineButton;
property Orientation : TsuiProgressBarOrientation read m_Orientation write SetOrientation;
property UIStyle : TsuiUIStyle read m_UIStyle write SetUIStyle;
property Max : Integer read GetMax write SetMax;
property Min : Integer read GetMin write SetMin;
property Position : Integer read GetPosition write SetPosition;
property SmallChange : TScrollBarInc read m_SmallChange write m_SmallChange;
property LargeChange : TScrollBarInc read GetLargeChange write SetLargeChange;
property PageSize : Integer read GetPageSize write SetPageSize;
property Align;
property Anchors;
property BiDiMode;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ParentBiDiMode;
property ParentColor;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Visible;
property OnChange : TNotifyEvent read GetOnChange write SetOnChange;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDock;
property OnStartDrag;
end;
implementation
uses SUIPublic;
{ TsuiScrollBar }
procedure TsuiScrollBar.CMColorChanged(var Message: TMessage);
begin
if m_TrackBar <> nil then
m_TrackBar.Color := Color;
end;
procedure TsuiScrollBar.CMVisibleChanged(var Message: TMessage);
begin
inherited;
m_TrackBar.Visible := Visible;
m_Btn1.Visible := Visible;
m_Btn2.Visible := Visible;
end;
constructor TsuiScrollBar.Create(AOwner: TComponent);
begin
inherited;
ControlStyle := ControlStyle - [csAcceptsControls];
m_SliderLeft := TBitmap.Create();
m_SliderCenter := TBitmap.Create();
m_SliderRight := TBitmap.Create();
m_TrackBar := TsuiScrollTrackBar.Create(self);
m_TrackBar.Parent := self;
m_TrackBar.ShowTick := false;
m_TrackBar.TabStop := false;
m_TrackBar.Transparent := false;
m_TrackBar.Max := 100;
m_Btn1 := TsuiImageButton.Create(self);
m_Btn1.Parent := self;
m_Btn1.OnMouseContinuouslyDown := MouseContinuouslyDownInc;
m_Btn1.MouseContinuouslyDownInterval := 100;
m_Btn1.TabStop := false;
m_Btn2 := TsuiImageButton.Create(self);
m_Btn2.Parent := self;
m_Btn2.OnMouseContinuouslyDown := MouseContinuouslyDownDec;
m_Btn2.MouseContinuouslyDownInterval := 100;
m_Btn2.TabStop := false;
BevelOuter := bvNone;
BevelInner := bvNone;
Orientation := suiHorizontal;
m_SmallChange := 1;
m_LineButton := 0;
Height := 185;
UIStyle := GetSUIFormStyle(AOwner);
PlaceTrackBarAndButton();
end;
destructor TsuiScrollBar.Destroy;
begin
m_Btn2.Free();
m_Btn1.Free();
m_TrackBar.Free();
m_SliderRight.Free();
m_SliderCenter.Free();
m_SliderLeft.Free();
inherited;
end;
function TsuiScrollBar.GetLargeChange: TScrollBarInc;
begin
Result := m_TrackBar.PageSize;
end;
function TsuiScrollBar.GetLastChange: Integer;
begin
Result := m_TrackBar.LastChange;
end;
function TsuiScrollBar.GetMax: Integer;
begin
Result := m_TrackBar.Max;
end;
function TsuiScrollBar.GetMin: Integer;
begin
Result := m_TrackBar.Min;
end;
function TsuiScrollBar.GetOnChange: TNotifyEvent;
begin
Result := m_TrackBar.OnChange;
end;
function TsuiScrollBar.GetPageSize: Integer;
begin
Result := m_TrackBar.PageSize;
end;
function TsuiScrollBar.GetPosition: Integer;
begin
Result := m_TrackBar.Position;
end;
function TsuiScrollBar.GetSliderVisible: Boolean;
begin
Result := m_TrackBar.SliderVisible
end;
procedure TsuiScrollBar.MouseContinuouslyDownDec(Sender: TObject);
begin
m_TrackBar.Position := m_TrackBar.Position - m_SmallChange;
end;
procedure TsuiScrollBar.MouseContinuouslyDownInc(Sender: TObject);
begin
m_TrackBar.Position := m_TrackBar.Position + m_SmallChange;
end;
procedure TsuiScrollBar.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (
(Operation = opRemove) and
(AComponent = m_FileTheme)
)then
begin
m_FileTheme := nil;
SetUIStyle(SUI_THEME_DEFAULT);
end;
end;
procedure TsuiScrollBar.PlaceTrackBarAndButton;
begin
m_TrackBar.Orientation := m_Orientation;
if (Height = 0) or (Width = 0) then
begin
Visible := False;
end
else
begin
if m_Orientation = suiVertical then
begin
m_Btn2.Top := 0;
m_Btn2.Left := 0;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -