How to set the Row Height, row background color, and column width of the DBGrid header row, selected record row

Source: Internet
Author: User
How to set the Row Height and row background color of the DBGrid header row, the selected record row, and the column width Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061216115412271.html
RT

1. Columns attributes

2. ondrawcolumncell event
Procedure tform1.dbgrid1drawcolumncell (Sender: tobject; const rect: trect;
Datacol: integer; column: tcolumn; State: tgriddrawstate );
VaR I: integer;
Begin
If gdselected in State then exit;
For I: = 0 to (sender as TDBGrid). Columns. Count-1 do
Begin
(Sender as TDBGrid). Columns [I]. Title. Font. Name: = 'body ';
(Sender as TDBGrid). Columns [I]. Title. Font. Size: = 12;
(Sender as TDBGrid). Columns [I]. Title. Font. Color: = clnavy;
(Sender as TDBGrid). Columns [I]. Title. Color: = $00ffc4c4;
End;
If query1.recno mod 2 = 0 then
(Sender as TDBGrid). Canvas. Brush. Color: = clinfobk
Else
(Sender as TDBGrid). Canvas. Brush. Color: = RGB (191,255,223 );
Dbgrid1.defadrawcolumncell (rect, datacol, column, State );
With (sender as TDBGrid). Canvas do begin
Pen. Color: = $00ff0000;
MoveTo (rect. Left, rect. Bottom );
Lineto (rect. Right, rect. Bottom );
Pen. Color: = clteal;
MoveTo (rect. Right, rect. Top );
Lineto (rect. Right, rect. Bottom );
End;
End;

How to set the Row Height? How does one set the Row Height of the title?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.