Link to home
Start Free TrialLog in
Avatar of 123456
123456Flag for Iran, Islamic Republic of

asked on

Disabling Dbgrid Scrollbars

Hi,
How can i Disable  Dbgrid Scrollbars ?


Regards
Avatar of ThoseBug
ThoseBug

this is  a component without scrollbar...hope helps you. Save like a dbgridnosc.pas and install

unit DBgridNoSc;
 
interface
 
uses
  WinTypes, WinProcs, Classes, DBGrids;
 
type
  TDBgridNoSc = class(TDBGrid)
  protected
    procedure Paint; override;
  end;
 
procedure Register;
 
implementation
 
procedure TDBgridNoSc.Paint;
begin
  SetScrollRange(Self.Handle, SB_VERT, 0, 0, False);
  inherited Paint;
end;
 
procedure Register;
begin
  RegisterComponents('Data Controls', [TDBgridNoSc]);
end;
end.
Avatar of 123456

ASKER

hi,
Can you tell me how can i use of your paint procedure in my Dbgrid procedures?
123456,
this is code for a new component i 'dont know how to use in dbgrid self.....sorry.
hi,

on the Form OnShow fill:

procedure TForm1.FormShow(Sender: TObject);
begin
ShowScrollBar(DBGrid1.Handle, SB_VERT, False);
ShowScrollBar(DBGrid1.Handle, SB_HORZ, False);
end;

and on the DBGrid.DataSource.OnDataChanged:

procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
begin
ShowScrollBar(DBGrid1.Handle, SB_VERT, False);
ShowScrollBar(DBGrid1.Handle, SB_HORZ, False);
end;

Bogdan
Avatar of 123456

ASKER

hi,
bpana, you answer is better than thosebug,
but when i moved through records, scroll bar disappear on bad form,do any way existed That We tell dbgrid one Time For disappearing Scrollbars,and We dont need to Tell it after any changing in datasource .


ASKER CERTIFIED SOLUTION
Avatar of bpana
bpana

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial