BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How i can modify TDBGRID for have a FLAT column header ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Delphi Guru
Guest





PostPosted: Mon Oct 13, 2003 8:49 am    Post subject: How i can modify TDBGRID for have a FLAT column header ? Reply with quote



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





PostPosted: Mon Oct 13, 2003 12:34 pm    Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? Reply with quote



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





PostPosted: Mon Oct 13, 2003 1:27 pm    Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? Reply with quote



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





PostPosted: Mon Oct 13, 2003 3:06 pm    Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? Reply with quote

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





PostPosted: Mon Oct 13, 2003 4:47 pm    Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? Reply with quote

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 ! Wink
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





PostPosted: Wed Oct 15, 2003 8:23 am    Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? Reply with quote

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





PostPosted: Wed Oct 15, 2003 1:41 pm    Post subject: Re: How i can modify TDBGRID for have a FLAT column header ? Reply with quote

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 Smile
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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.