sGroupBox.pas may have a test left-over in the code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38331
    HeDiBo
    Participant

    I found this code in sGroupBox.pas:

    Code:
    procedure PaintThemedGroupBox;
    var
    SavedDC: hdc;
    OuterRect: TRect;
    Box: TThemedButton;
    Details: TThemedElementDetails;
    begin
    with Canvas do begin
    OuterRect := ClientRect;
    OuterRect.Top := CaptionMargin.Top + CaptionHeight div 2;

    if not ParentColor then // <<< Also done below
    FillDC(Handle, MkRect(Self), Color); // <<< Also done below if Enabled then
    Box := tbGroupBoxNormal
    else
    Box := tbGroupBoxDisabled;

    Details := acThemeServices.GetElementDetails(Box);
    acThemeServices.DrawElement(Handle, Details, OuterRect);
    SelectClipRgn(Handle, 0);

    SavedDC := SaveDC(Handle);
    try
    IntersectClipRect(Handle, CaptionRect.Left – CaptionMargin.Left,
    CaptionRect.Top – CaptionMargin.Top,
    CaptionRect.Right + CaptionMargin.Right,
    CaptionRect.Bottom + CaptionMargin.Bottom);

    Details := acThemeServices.GetElementDetails(ttBody);
    if ParentColor then
    acThemeServices.DrawParentBackground(Self.Handle, Handle, @Details, False)
    else
    FillDC(Handle, MkRect(Self), Color);

    finally
    RestoreDC(Handle, SavedDC);
    end;

    the “if not ParentColor” bit looks like a test left-over.

    #59812
    Support
    Keymaster

    I'm not sure what you mean. If not ParentColor then filled by Color. This behavior is not correct?

    #59815
    dxMos
    Participant
    'Support' wrote:

    I'm not sure what you mean. If not ParentColor then filled by Color. This behavior is not correct?

    Correct but double 😉

    Code:
    if not ParentColor then
    FillDC(Handle, MkRect(Self), Color);
    ….
    ….
    if ParentColor then
    ….
    else
    FillDC(Handle, MkRect(Self), Color);

    Cheers

    Thomas

    #59816
    Support
    Keymaster

    Ahh, I see it now, thanks 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘sGroupBox.pas may have a test left-over in the code’ is closed to new replies.