Solved

How to Disable the Vertical Scrollbar in the TDBGrid object

Posted on 2004-04-24
11
4,606 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

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