Jump to content


Photo

tnxheaderpanel


  • Please log in to reply
4 replies to this topic

#1 didiergm

didiergm
  • Honorable Members
  • 148 posts
  • Gender:Male
  • Location:France

Posted 22 December 2010 - 02:40 PM

Hello all,

Setting a tnxheaderpanel/PanelStyle: ptGradient works in Delphi IDE (ie the background is display as a gradient) but when running the panel background is solid white. What am I missing ?

Also is there a way to specify the gradient start and end colors ?

thanks in advance,

Didier

EDIT: in my application there is one tnxheader panel which has the gradient I expect, and ... I do not knwo why because on the same form all other panels are white I must have changed something but I am not sure what . I placed on the form a tnxColorScheme and this does not seem to influence the tnxheader panel

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 23 December 2010 - 12:48 AM

Hello Didier,

Can you please copy/paste me this NxHeaderPanel to me?

Please also check that maybe AdaptiveColors are set to False?

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 didiergm

didiergm
  • Honorable Members
  • 148 posts
  • Gender:Male
  • Location:France

Posted 23 December 2010 - 04:02 PM

here it is:
object NxHeaderPanel1: TNxHeaderPanel
Left = 0
Top = 0
Width = 445
Height = 353
Align = alClient
Caption = 'Sales '
HeaderFont.Charset = ANSI_CHARSET
HeaderFont.Color = clWindowText
HeaderFont.Height = -16
HeaderFont.Name = 'Arial'
HeaderFont.Style = [fsBold]
PanelStyle = ptGradient
ParentHeaderFont = False
TabOrder = 0
ExplicitLeft = 80
ExplicitTop = 8
FullWidth = 445


#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 24 December 2010 - 01:27 AM

Hello Didier,

Please replace next procedure in NxCollection.pas:

CODE
procedure TNxHeaderPanel.Paint;
var
  GlyphPoint: TPoint;
  HeaderRect, BodyRect, MarginRect, CaptionRect: TRect;
  TextLeft, TextRight: Integer;
begin
  inherited;
  if FDisplayStyle = dsPanelOnly then
  begin
    DrawBackground(ClientRect); // paint complete paint area.
    Exit;
  end;

    with Canvas do
  begin
    if FDisplayStyle <> dsHeaderOnly then
    begin
      BodyRect := Rect(0, FHeaderSize, ClientWidth, ClientHeight);
          Brush.Color := Self.Color;
      if not Assigned(Picture.Graphic) or Picture.Graphic.Empty then
      begin
        DrawBackground(BodyRect);
      end else StretchDraw(BodyRect, Picture.Graphic);

      if csDesigning in ComponentState then
      begin
        Brush.Color := clBtnFace;
              MarginRect := Rect(FInnerMargins.Left, FHeaderSize + FInnerMargins.Top, ClientWidth - FInnerMargins.Right,
            ClientHeight - FInnerMargins.Bottom);
        InflateRect(MarginRect, 1, 1);
        FrameRect(MarginRect);
      end;
    end;

    Font.Assign(FHeaderFont);
    if hoColorSchemeFont in FOptions then Font.Color := SchemeColor(seHeaderFont);
    HeaderRect := Rect(0, 0, ClientWidth, FHeaderSize);
    case FHeaderStyle of
      psFlat: DrawFlatHeader(HeaderRect);
      psNormal: DrawNormalHeader(HeaderRect);
      psSectionHeader: DrawSectionHeader(HeaderRect);
      psVista: DrawVistaHeader(HeaderRect);
      psWindowsLive: DrawWindowsLiveHeader(HeaderRect);
    end;

    TextLeft := FIndent;
    TextRight := ClientWidth;

    { Draw Close Button }
    if (hoCollapseButton in Options) then
    begin
      DrawButton(GetButtonRect);
      TextRight := GetButtonRect.Left;
    end;

    { Draw Glyph }
    if Expanded and Assigned(FGlyph) and not FGlyph.Empty then
    begin
      GlyphPoint := GetGlyphPos;
      ApplyBitmap(Canvas, GlyphPoint.X, GlyphPoint.Y, FGlyph);
      Inc(TextLeft, FGlyph.Width + spHeadPnlGlyphIndent + 2);
    end;

    { Draw Text }
    if FExpanded then
    begin
      CaptionRect := Rect(TextLeft, 0, TextRight, FHeaderSize);
          DrawTextRect(Canvas, CaptionRect, Caption);
    end;
  end;
end;


Please tell me is it working now.

Thank you
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 didiergm

didiergm
  • Honorable Members
  • 148 posts
  • Gender:Male
  • Location:France

Posted 27 December 2010 - 05:14 PM

Sorry for the late answer I was away for a few days

Yes, it does work fine now; I'll do some more testing but if you do not hear from me in the next 24 hours, please consider it fixed.

Didier




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users