Registriert seit: 25. Sep 2008
1 Beiträge
|
Re: ScrollBar bei DBGrid immer anzeigen
25. Sep 2008, 15:47
Hi, this is similar & works well:
Delphi-Quellcode:
unit ScrollDBGrid;
interface
uses
Windows,
Messages,
StdCtrls,
DbGrids;
type
TScrollDBGrid = class(TDbGrid)
private
FAlwaysScroll: TScrollStyle;
procedure SetAlwaysScroll( const Value: TScrollStyle);
procedure WMNCCalcSize( var Msg: TMessage); message WM_NCCALCSIZE;
published
property AlwaysScroll: TScrollStyle
read FAlwaysScroll
write SetAlwaysScroll
default ssNone;
end;
implementation
{ TFlexibleScrollDBGrid }
procedure TScrollDBGrid.SetAlwaysScroll( const Value: TScrollStyle);
begin
if not (FAlwaysScroll = Value) then
begin
FAlwaysScroll := Value;
RecreateWnd;
end;
end;
procedure TScrollDBGrid.WMNCCalcSize( var Msg: TMessage);
var
NewStyle: Integer;
begin
NewStyle := GetWindowLong( Handle, GWL_STYLE);
if ([ScrollBars, FAlwaysScroll] * [ssHorizontal, ssBoth] <> []) then
NewStyle := NewStyle or WS_HSCROLL;
if ([ScrollBars, FAlwaysScroll] * [ssVertical, ssBoth] <> []) then
NewStyle := NewStyle or WS_VSCROLL;
SetWindowLong( Handle, GWL_STYLE, NewStyle);
inherited;
end;
end.
Best regards.
(jope)
|
|
Zitat
|