?? suidbctrls.pas
字號:
UpdateScrollBarsPos();
end;
procedure TsuiDBMemo.UpdateInnerScrollBars;
begin
if (m_VScrollBar <> nil) and (m_HScrollBar <> nil) then
ScrollBars := ssBoth
else if (m_VScrollBar <> nil) and (m_HScrollBar = nil) then
ScrollBars := ssVertical
else if (m_HScrollBar <> nil) and (m_VScrollBar = nil) then
ScrollBars := ssHorizontal
else
ScrollBars := ssNone;
end;
procedure TsuiDBMemo.UpdateScrollBars;
var
info : tagScrollInfo;
barinfo : tagScrollBarInfo;
begin
if m_UserChanging then
Exit;
m_SelfChanging := true;
if m_HScrollBar <> nil then
begin
barinfo.cbSize := SizeOf(barinfo);
GetScrollBarInfo(Handle, Integer(OBJID_HSCROLL), barinfo);
if (barinfo.rgstate[0] = STATE_SYSTEM_INVISIBLE) or
(barinfo.rgstate[0] = STATE_SYSTEM_UNAVAILABLE) then
begin
m_HScrollBar.LineButton := 0;
m_HScrollBar.Enabled := false;
m_HScrollBar.SliderVisible := false;
end
else
begin
m_HScrollBar.LineButton := abs(barinfo.xyThumbBottom - barinfo.xyThumbTop);
m_HScrollBar.SmallChange := 3 * m_HScrollBar.PageSize;
m_HScrollBar.Enabled := true;
m_HScrollBar.SliderVisible := true;
end;
info.cbSize := SizeOf(info);
info.fMask := SIF_ALL;
GetScrollInfo(Handle, SB_HORZ, info);
m_HScrollBar.Max := info.nMax - Integer(info.nPage) + 1;
m_HScrollBar.Min := info.nMin;
m_HScrollBar.Position := info.nPos;
end;
if m_VScrollBar <> nil then
begin
barinfo.cbSize := SizeOf(barinfo);
GetScrollBarInfo(Handle, Integer(OBJID_VSCROLL), barinfo);
if (barinfo.rgstate[0] = STATE_SYSTEM_INVISIBLE) or
(barinfo.rgstate[0] = STATE_SYSTEM_UNAVAILABLE) then
begin
m_VScrollBar.LineButton := 0;
m_VScrollBar.Enabled := false;
m_VScrollBar.SliderVisible := false;
end
else
begin
m_VScrollBar.LineButton := abs(barinfo.xyThumbBottom - barinfo.xyThumbTop);
m_VScrollBar.Enabled := true;
m_VScrollBar.SliderVisible := true;
end;
info.cbSize := SizeOf(info);
info.fMask := SIF_ALL;
GetScrollInfo(Handle, SB_VERT, info);
m_VScrollBar.Max := info.nMax - Integer(info.nPage) + 1;
m_VScrollBar.Min := info.nMin;
m_VScrollBar.Position := info.nPos;
end;
m_SelfChanging := false;
end;
procedure TsuiDBMemo.UpdateScrollBarsPos;
begin
if m_HScrollBar <> nil then
begin
m_HScrollBar.Left := Left + 1;
m_HScrollBar.Top := Top + Height - m_HScrollBar.Height - 2;
if m_VScrollBar <> nil then
m_HScrollBar.Width := Width - 2 - m_VScrollBar.Width
else
m_HScrollBar.Width := Width - 2
end;
if m_VScrollBar <> nil then
begin
m_VScrollBar.Left := Left + Width - m_VScrollBar.Width - 2;
m_VScrollBar.Top := Top + 1;
if m_HScrollBar <> nil then
m_VScrollBar.Height := Height - 2 - m_HScrollBar.Height
else
m_VScrollBar.Height := Height - 2;
end;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMClear(var Message: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMKeyDown(var Message: TWMKeyDown);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMLBUTTONDOWN(var Message: TMessage);
begin
inherited;
m_MouseDown := true;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMMOUSEWHEEL(var Message: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMMOVE(var Msg: TMessage);
begin
inherited;
UpdateScrollBarsPos();
end;
procedure TsuiDBMemo.WMSetText(var Message: TWMSetText);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMSIZE(var Msg: TMessage);
begin
inherited;
UpdateScrollBarsPos();
end;
procedure TsuiDBMemo.WMHSCROLL(var Message: TWMHScroll);
begin
inherited;
if m_UserChanging then
Exit;
UpdateScrollBars();
end;
procedure TsuiDBMemo.WMLButtonUp(var Message: TMessage);
begin
inherited;
m_MouseDown := false;
end;
procedure TsuiDBMemo.WMMOUSEMOVE(var Message: TMessage);
begin
inherited;
if m_MouseDown then UpdateScrollBars();
end;
procedure TsuiDBMemo.WMVSCROLL(var Message: TWMVScroll);
begin
inherited;
if m_UserChanging then
Exit;
UpdateScrollBars();
end;
procedure TsuiDBMemo.SetFileTheme(const Value: TsuiFileTheme);
begin
m_FileTheme := Value;
if m_VScrollBar <> nil then
m_VScrollBar.FileTheme := Value;
if m_HScrollBar <> nil then
m_HScrollBar.FileTheme := Value;
SetUIStyle(m_UIStyle);
end;
procedure TsuiDBMemo.SetUIStyle(const Value: TsuiUIStyle);
var
OutUIStyle : TsuiUIStyle;
begin
m_UIStyle := Value;
if UsingFileTheme(m_FileTheme, m_UIStyle, OutUIStyle) then
m_BorderColor := m_FileTheme.GetColor(SUI_THEME_CONTROL_BORDER_COLOR)
else
m_BorderColor := GetInsideThemeColor(OutUIStyle, SUI_THEME_CONTROL_BORDER_COLOR);
if m_VScrollBar <> nil then
m_VScrollBar.UIStyle := OutUIStyle;
if m_HScrollBar <> nil then
m_HScrollBar.UIStyle := OutUIStyle;
Repaint();
end;
{ TsuiDBImage }
constructor TsuiDBImage.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
BorderWidth := 2;
UIStyle := GetSUIFormStyle(AOwner);
end;
procedure TsuiDBImage.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 TsuiDBImage.SetBorderColor(const Value: TColor);
begin
m_BorderColor := Value;
Repaint();
end;
procedure TsuiDBImage.SetFileTheme(const Value: TsuiFileTheme);
begin
m_FileTheme := Value;
SetUIStyle(m_UIStyle);
end;
procedure TsuiDBImage.SetUIStyle(const Value: TsuiUIStyle);
var
OutUIStyle : TsuiUIStyle;
begin
m_UIStyle := Value;
if UsingFileTheme(m_FileTheme, m_UIStyle, OutUIStyle) then
m_BorderColor := m_FileTheme.GetColor(SUI_THEME_CONTROL_BORDER_COLOR)
else
m_BorderColor := GetInsideThemeColor(OutUIStyle, SUI_THEME_CONTROL_BORDER_COLOR);
Repaint();
end;
procedure TsuiDBImage.WMEARSEBKGND(var Msg: TMessage);
begin
inherited;
DrawControlBorder(self, m_BorderColor, Color);
end;
procedure TsuiDBImage.WMPAINT(var Msg: TMessage);
begin
inherited;
DrawControlBorder(self, m_BorderColor, Color);
end;
{ TsuiDBListBox }
constructor TsuiDBListBox.Create(AOwner: TComponent);
begin
inherited;
ControlStyle := ControlStyle + [csOpaque];
BorderStyle := bsNone;
BorderWidth := 2;
m_SelfChanging := false;
m_MouseDown := false;
UIStyle := GetSUIFormStyle(AOwner);
end;
procedure TsuiDBListBox.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if AComponent = nil then
Exit;
if (
(Operation = opRemove) and
(AComponent = m_VScrollBar)
)then
begin
m_VScrollBar := nil;
end;
if (
(Operation = opRemove) and
(AComponent = m_FileTheme)
)then
begin
m_FileTheme := nil;
SetUIStyle(SUI_THEME_DEFAULT);
end;
end;
procedure TsuiDBListBox.SetBorderColor(const Value: TColor);
begin
m_BorderColor := Value;
Repaint();
end;
procedure TsuiDBListBox.WMEARSEBKGND(var Msg: TMessage);
begin
inherited;
DrawControlBorder(self, m_BorderColor, Color);
end;
procedure TsuiDBListBox.WMPAINT(var Msg: TMessage);
begin
inherited;
DrawControlBorder(self, m_BorderColor, COlor);
end;
procedure TsuiDBListBox.CMEnabledChanged(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.LBADDSTRING(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.LBDELETESTRING(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.LBINSERTSTRING(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.LBNSELCHANGE(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.LBNSETFOCUS(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.LBSETCOUNT(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
procedure TsuiDBListBox.OnVScrollBarChange(Sender: TObject);
begin
if m_SelfChanging then
Exit;
SendMessage(Handle, WM_VSCROLL, MakeWParam(SB_THUMBPOSITION, m_VScrollBar.Position), 0);
Invalidate;
end;
procedure TsuiDBListBox.SetVScrollBar(const Value: TsuiScrollBar);
begin
if m_VScrollBar = Value then
Exit;
if m_VScrollBar <> nil then
begin
m_VScrollBar.OnChange := nil;
m_VScrollBar.LineButton := 0;
m_VScrollBar.Max := 100;
m_VScrollBar.Enabled := true;
end;
m_VScrollBar := Value;
if m_VScrollBar = nil then
Exit;
m_VScrollBar.Orientation := suiVertical;
m_VScrollBar.OnChange := OnVScrollBArChange;
m_VScrollBar.BringToFront();
UpdateScrollBarsPos();
end;
procedure TsuiDBListBox.UpdateScrollBars;
var
info : tagScrollInfo;
barinfo : tagScrollBarInfo;
begin
m_SelfChanging := true;
if m_VScrollBar <> nil then
begin
barinfo.cbSize := SizeOf(barinfo);
GetScrollBarInfo(Handle, Integer(OBJID_VSCROLL), barinfo);
if (barinfo.rgstate[0] = STATE_SYSTEM_INVISIBLE) or
(barinfo.rgstate[0] = STATE_SYSTEM_UNAVAILABLE) then
begin
m_VScrollBar.LineButton := 0;
m_VScrollBar.Enabled := false;
m_VScrollBar.Visible := false;
end
else
begin
m_VScrollBar.LineButton := abs(barinfo.xyThumbBottom - barinfo.xyThumbTop);
m_VScrollBar.Enabled := true;
m_VScrollBar.Visible := true;
end;
info.cbSize := SizeOf(info);
info.fMask := SIF_ALL;
GetScrollInfo(Handle, SB_VERT, info);
m_VScrollBar.Max := info.nMax - Integer(info.nPage) + 1;
m_VScrollBar.Min := info.nMin;
m_VScrollBar.Position := info.nPos;
end;
m_SelfChanging := false;
end;
procedure TsuiDBListBox.UpdateScrollBarsPos;
begin
if m_VScrollBar <> nil then
begin
m_VScrollBar.Left := Left + Width - m_VScrollBar.Width - 2;
m_VScrollBar.Top := Top + 1;
m_VScrollBar.Height := Height - 2;
end;
UpdateScrollBars();
end;
procedure TsuiDBListBox.WMDELETEITEM(var Msg: TMessage);
begin
inherited;
UpdateScrollBars();
end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -