Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Paint a splitter frame in TSpTBXCustomSplitter. #10

Open
pyscripter opened this issue Sep 24, 2018 · 0 comments
Open

Enhancement: Paint a splitter frame in TSpTBXCustomSplitter. #10

pyscripter opened this issue Sep 24, 2018 · 0 comments

Comments

@pyscripter
Copy link

pyscripter commented Sep 24, 2018

The SpTBXSplitter looks better with frame painted. In my fork I use a function:

procedure PaintSplitterFrame(Canvas : TCanvas; IsVertical: Boolean; var R: TRect);
var
  FrameBrush: HBRUSH;
begin
  if IsVertical then
    InflateRect(R, -1, 2)
  else
    InflateRect(R, 2, -1);
  OffsetRect(R, 1, 1);
  FrameBrush := CreateSolidBrush(ColorToRGB(CurrentSkin.GetThemedSystemColor(clBtnHighlight)));
  FrameRect(Canvas.Handle, R, FrameBrush);
  DeleteObject(FrameBrush);
  OffsetRect(R, -2, -2);
  FrameBrush := CreateSolidBrush(ColorToRGB(CurrentSkin.GetThemedSystemColor(clBtnShadow)));
  FrameRect(Canvas.Handle, R, FrameBrush);
  DeleteObject(FrameBrush);
end;

and in TSpTBXCustomSplitter.Paint added one line:

procedure TSpTBXCustomSplitter.Paint;
var
  ClientR, R, DragHandleR: TRect;
  C1, C2: TColor;
  PaintDefault: Boolean;
begin
  ClientR := ClientRect;
  PaintDefault := True;
  DoDrawBackground(Canvas, ClientR, pstPrePaint, PaintDefault);
  if PaintDefault then begin
    // Paint background
    if SkinManager.GetSkinType = sknSkin then
      CurrentSkin.PaintBackground(Canvas, ClientR, skncSplitter, sknsNormal, True, False, IsVertical)
    else begin
      if Color = clNone then
        Canvas.Brush.Color := CurrentSkin.GetThemedSystemColor(clBtnFace)
      else
        Canvas.Brush.Color := Color;
      SpFillRect(Canvas, ClientR, Canvas.Brush.Color);
      PaintSplitterFrame(Canvas, IsVertical, ClientR);  //<-- added
    end;

Alternatively, there could be an option for framing the splitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant