Solved

Extending vertical lines on a DBGrid

Posted on 2002-05-02
7
309 Views
Last Modified: 2010-08-05
Hello everyone,

I would like to have my DBGrid to have extended vertical gridlines until the bottom of the grid.

If you have for example only two records in a table, the column cells will be drawn only for those two records.  But it would be nicer to be able to extend the column delimiters vertically until the bottom of the grid.

Any ideas ?
0
Comment
Question by:fadyg
[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
  • 3
  • 3
7 Comments
 
LVL 8

Expert Comment

by:Cesario
ID: 6986205
Do you have the source code of Unit DBGrids ?
0
 

Author Comment

by:fadyg
ID: 6986384
Yes, but I would not like to modify these sources but rather subclass DBGrid.  That way I can still beneficiate from any new feature in the next Delphi release..
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6986954
Two ways : 1. Add empty records or paint your lines ( simulate the empty records ) on procedure WMPAINT(var Message: TWMPaint); Message WM_Paint;
0
Independent Software Vendors: 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:fadyg
ID: 6987974
I would go for the simulation of lines and not add records.  Do you have any piece of code that ?
0
 
LVL 9

Accepted Solution

by:
ginsonic earned 200 total points
ID: 6989517
This is a tip that I use it to make a flicker free DBGrid . How you can see, capture the grid image into Bitmap . Just paint your own's lines into the bitmap .

procedure WMPaint(var Message: TWMPaint);
var
  Bitmap: TBitmap;
  WinDC: HDC;
  PS: TPaintStruct;
  BegunPaint: Boolean;
begin
  BegunPaint := False;
  Bitmap := TBitmap.Create;
  try
    Bitmap.Width := Width;
    Bitmap.Height := Height;
    {Paint completely as normal, but into Bitmap}
    WinDC := Message.DC;
    Message.DC := Bitmap.Canvas.Handle;
    Inherited;
    {Need a Window DC ?}
    BegunPaint := WinDC = 0;
    if BegunPaint then
      WinDC := BeginPaint(Handle, PS);

      8<------
      Your code for paint lines
      -------->8      
 
      {Copy bitmap to screen}
      with Canvas.ClipRect do
        BitBlt(WinDC, Left, Top, Right - Left, Bottom - Top, Bitmap.Canvas.Handle, Left, Top, SRCCOPY);
  finally
    Bitmap.Free;
    if BegunPaint then
      EndPaint(Handle, PS);
  end;
end;
0
 

Author Comment

by:fadyg
ID: 6995829
The flicker part is really a good idea ;)
Drawing the lines will be just a matter of some canvas extra work (Moveto & Lineto) at the boundary of each column

thx
Fady
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6996544
My pleasure,
Nick
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 63
How to convert memory stream to PDF file 6 188
update joined tables 2 64
how to change, disabled button color FMX ? 1 51
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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