Solved

How to Disable the Vertical Scrollbar in the TDBGrid object

Posted on 2004-04-24
11
4,399 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
Comment Utility

Place neat Panel on it
0
 

Author Comment

by:EternalNewbie
Comment Utility
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
Comment Utility

I mean standard TPanel neatly placed :)
0
 

Author Comment

by:EternalNewbie
Comment Utility
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
Comment Utility

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 50 total points
Comment Utility

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
Comment Utility

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

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

Author Comment

by:EternalNewbie
Comment Utility
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
Comment Utility
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
Comment Utility
Some points are better than none - Im sure Mokule can concur?

Shane
0
 
LVL 17

Expert Comment

by:mokule
Comment Utility
Thats it :)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now