| View previous topic :: View next topic |
| Author |
Message |
Delphi Guru Guest
|
Posted: Mon Oct 13, 2003 8:49 am Post subject: How i can modify TDBGRID for have a FLAT column header ? |
|
|
Hi
How i can modify TDBGRID for have a FLAT column header ?
No commercial component ( DevExpress..) ,
i have already a my component ( MyDbgid = Class TDbgrid..... )
|
|
| Back to top |
|
 |
Vitaliy Lyanchevskiy Guest
|
Posted: Mon Oct 13, 2003 12:34 pm Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? |
|
|
Hello, Delphi!
13.10.2003 10:49, Delphi Guru -> All:
DG> How i can modify TDBGRID for have a FLAT column header ?
DG> i have already a my component ( MyDbgid = Class TDbgrid..... )
procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState:
TGridDrawState); override;
procedure MyDbgid.DrawCell(ACol, ARow: Longint; ARect: TRect; AState:
TGridDrawState);
begin
if (dgTitles in Options) and (ARow = 0) then
// your header drawing
else
inherited;
end;
--
WBR, Vitaliy Lyanchevskiy (E-Mail: [email]elic (AT) bisc (DOT) minsk.by[/email])
|
|
| Back to top |
|
 |
Delphi Guru Guest
|
Posted: Mon Oct 13, 2003 1:27 pm Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? |
|
|
| Quote: | if (dgTitles in Options) and (ARow = 0) then
// your header drawing
|
Hi
there problem is here ! ;-)
How i can draw a FLAT header ?
|
|
| Back to top |
|
 |
Constantine Yannakopoulos Guest
|
Posted: Mon Oct 13, 2003 3:06 pm Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? |
|
|
Author := "Delphi Guru";
| Quote: | How i can draw a FLAT header ?
|
Here's how you can paint one of its buttons:
DrawFrameControl(DC, Rect, DFC_BUTTON, DFCS_FLAT);
Include DFCS_PUSHED in the State flags (4th parameter) to draw it in
its pressed state.
--
Constantine
|
|
| Back to top |
|
 |
Vitaliy Lyanchevskiy Guest
|
Posted: Mon Oct 13, 2003 4:47 pm Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? |
|
|
Hello, Delphi!
13.10.2003 15:27, Delphi Guru -> All:
| Quote: | if (dgTitles in Options) and (ARow = 0) then
// your header drawing
|
DG> there problem is here !
DG> How i can draw a FLAT header ?
if (dgTitles in Options) and (ARow = 0)
and not ((dgIndicator in Options) and (ACol = 0))
then begin
if dgIndicator in Options then Dec(ACol);
if (ACol >= 0) and (ACol < FieldCount) then begin
Canvas.Font.Color := clBtnText;
Canvas.Brush.Color := clBtnFace;
with Fields[ACol] do WriteText(ARect, DisplayLabel, Alignment);
end;
end
else
inherited;
Does it look like "a FLAT header" ?
--
WBR, Vitaliy Lyanchevskiy (E-Mail: [email]elic (AT) bisc (DOT) minsk.by[/email])
|
|
| Back to top |
|
 |
Delphi Guru Guest
|
Posted: Wed Oct 15, 2003 8:23 am Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? |
|
|
| Quote: | with Fields[ACol] do WriteText(ARect, DisplayLabel, Alignment);
|
Hi
an error in compiler time :
Undeclared Identifier : WRITETEXT
Hint ?
|
|
| Back to top |
|
 |
Vitaliy Lyanchevskiy Guest
|
Posted: Wed Oct 15, 2003 1:41 pm Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? |
|
|
Hello, Delphi!
15.10.2003 10:23, Delphi Guru -> All:
| Quote: | with Fields[ACol] do WriteText(ARect, DisplayLabel, Alignment);
|
DG> an error in compiler time :
DG> Undeclared Identifier : WRITETEXT
Sorry
Replace "WriteText(...);" with:
Canvas.TextRect(ARect, ARect.Left + 2, ARect.Top + 1, DisplayLabel);
--
WBR, Vitaliy Lyanchevskiy (E-Mail: [email]elic (AT) bisc (DOT) minsk.by[/email])
|
|
| Back to top |
|
 |
|