How i can hide or remove scrolling by horizontal on dbgrid in Delphi7. I have try by changing width onResize but its not correctly way.
Try this:
EnableScrollBar(DBGrid1.Handle,SB_HORZ,ESB_DISABLE_BOTH);
ShowScrollBar(DBGrid1.Handle,SB_HORZ,False);
The problem is that disables the scroll, but it displays :-(
Other option is:
TDBgrid2 = class(TDBgrid)
private
procedure WMNCCalcSize(var msg: TMessage); message WM_NCCALCSIZE;
end;
.
.
procedure TDBgrid2.WMNCCalcSize(var msg: TMessage);
var
style: Integer;
begin
style := getWindowLong( handle, GWL_STYLE );
if (style and WS_HSCROLL) <> 0 then
SetWindowLong( handle, GWL_STYLE, style and not WS_HSCROLL );
inherited;
end;
It is more complicated, but it is the perfect solution.