Solved

How to Disable the Vertical Scrollbar in the TDBGrid object

Posted on 2004-04-24
11
4,467 Views
Last Modified: 2011-03-06
I am using Delphi 7
I have a DBGrid object that shows a database table with just 5 records
The horizontal scroll bar only shows when the columns are bigger than the avaliable space, but vertical scrollbar shows always no mather the number of records

I don't want the vertical scrollbar to show at all on the grid, never.

Please help...
0
Comment
Question by:EternalNewbie
  • 6
  • 3
  • 2
11 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 10908485

Place neat Panel on it
0
 

Author Comment

by:EternalNewbie
ID: 10908499
humm. is that "Neat panel" a standard Delphi component ?  
Can't remember of seeing it ?

if is notm would you please let me know where I can find it ?
0
 
LVL 17

Expert Comment

by:mokule
ID: 10908512

I mean standard TPanel neatly placed :)
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:EternalNewbie
ID: 10908527
You mean a panel placed over the grid to hide the scrollbar ?

I am placing like 7 grids side by side to make a dinamic agenda ( 7 week days, 7 grids).

I guess I can place the grids to overwrite eachother and a panel on last one but that doesnt seem a professional way to do it. it must be a way to set the verticalscroll not to show.

I read that it can be done using TCustomGrid, but I don't know how to use that TCustomGrid.

0
 
LVL 17

Expert Comment

by:mokule
ID: 10908547

Yes I mean to hide every of Your 7 scroll bars with Tpanels. It'll be the fasted way to do it. There is no easy way of gettig rid of verticel scroll bar in DBGrid. At least I don't know it. If You set panel to be flat there will be no difference in look.
0
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 50 total points
ID: 10908556

You need to make a new component derived from TDBGrid for this. The
following shows an example for a TDBGRID descendent but the strategy
works with about every control that uses standard window scrollbars.

type
  TNoVScrollTDBGrid = Class( TDBGrid )
  private
    Procedure WMNCCalcSize( Var msg: TMessage );
      message WM_NCCALCSIZE;
  end;
 
procedure TNoVScrollDBGrid.WMNCCalcSize(var msg: TMessage);
var
  style: Integer;
begin
  style := getWindowLong( handle, GWL_STYLE );
  If (style and WS_VSCROLL) <> 0 Then
    SetWindowLong( handle, GWL_STYLE, style and not WS_VSCROLL );
  inherited;
end;


Shane
0
 
LVL 17

Accepted Solution

by:
mokule earned 75 total points
ID: 10908562

If You really want to fight with it You can also use

  ShowScrollBar(DBGrid1.Handle,SB_VERT,FALSE);
0
 

Author Comment

by:EternalNewbie
ID: 10908613
Perfect.

yours line works great mokule.

but shane, you've got me interested on that way to derive a component from another. I have read about it and looks the way to custumise about anything, even that I couldnt put it to work, still you've givven me material to try and learn.

I really feel bad about spliting points, but I feel that otherwise would be unfair.

Really hope no one gets hurt.

0
 
LVL 17

Expert Comment

by:mokule
ID: 10908808
Why do You feel bad while splitting points?
It's quite normal when You get real help from more than one person.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10908832
Some points are better than none - Im sure Mokule can concur?

Shane
0
 
LVL 17

Expert Comment

by:mokule
ID: 10908883
Thats it :)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question