Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Extending vertical lines on a DBGrid

Posted on 2002-05-02
7
Medium Priority
?
318 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 800 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

618 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