Re: ScrollBar



FrancoJommi wrote:
I tried the following solution to my problem. I think it works, but I still
need to do some test. Particularly I don't know how to retrieve the number
of rows of the DBGrid so that I can suppress the vertical scroll bar when
possible only. Here is a sample of my test:
type
TForm1 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Table1: TTable;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
public
FScroll: TWndMethod;
procedure Scroll(var Msg: TMessage);
end;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
FScroll := DBGrid1.WindowProc; // metto da parte l'originale
DBGrid1.WindowProc := Scroll;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
DBGrid1.WindowProc := FScroll; // reset
FScroll := nil;
end;

procedure TForm1.Scroll(var Msg: TMessage);
begin
// make the vertical scroll bar not visible
ShowScrollBar(DBGrid1.Handle, SB_VERT, False);
FScroll(Msg); // continua a fare i cavoli suoi
end;
end.

"Jamie" <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> ha scritto nel
messaggio news:PQ8mi.18$Mf7.16@xxxxxxxxxxxxxxx

FrancoJommi wrote:


How do I hide the vertical ScrollBar in a DBGrid ? I tried "
ShowScrollBar(MyDBGrid.Handle, SB_BOTH, false);" but it doesn't work.
I thought I could get rid of the ScrollBar simply by setting the height

of

my DBGrid to a value exceeding the max number of lines I will show, but

I it

is not as I thought. Can you help ?




Try Adjusting the ClientWidth and ClientHeigth of the DBgrid
reduce it down.
Normally the scrollbars are set to automatic if the client
is larger than the parent window the client sits in.
etc.

--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5




Yes, that is one way of doing it.
if it works for you, then you're all set..



--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5

.



Relevant Pages

  • Re: ScrollBar
    ... procedure FormDestroy(Sender: TObject); ... procedure Scroll(var Msg: TMessage); ... // make the vertical scroll bar not visible ... Normally the scrollbars are set to automatic if the client ...
    (comp.lang.pascal.delphi.misc)
  • Re: What is the width of UserControl vertical scroll bar
    ... > I need to set the client size width of a user control and leave room for a ... > vertical scroll bar, but I don't know how wide it is. ... > Seems I remember once checking system info for the width but don't ...
    (microsoft.public.dotnet.languages.vb)
  • What is the width of UserControl vertical scroll bar
    ... I need to set the client size width of a user control and leave room for a ... vertical scroll bar, but I don't know how wide it is. ... Seems I remember once checking system info for the width but don't remember ...
    (microsoft.public.dotnet.languages.vb)