procedure TQGroupBox.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
Begin
Style := Style and Not WS_CLIPCHILDREN;
Style := Style and Not WS_CLIPSIBLINGS;
WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
End ;
end;
procedure TQGroupBox.Paint;
var
H: Integer;
R, R1: TRect;
Flags: Longint;
CaptionRect,
OuterRect: TRect;
Size: TSize;
Box: TThemedButton;
Details: TThemedElementDetails;
begin
with Canvas do
begin
Font := Self.Font;
Brush.Style := bsClear ;
R := Rect(0, 0, Width, Height);
FillRect(R);
if Text <> '' then
H := TextHeight('0')
Else
H := 2 ;
R := Rect(0, H div 2 - 1, Width, Height);
If FShowBox Then
Begin
if Ctl3D then
begin
Inc(R.Left);
Inc(R.Top);
Pen.Color := clBtnHighlight ;
RoundRect(R.Left, R.Top, R.Right, R.Bottom, FAngle, FAngle);
OffsetRect(R, -1, -1);
Pen.Color := clWindowText ;
end
else
begin
Pen.Color := BoxColor ;
Font.Color := BoxColor ;
end ;
RoundRect(R.Left, R.Top, R.Right, R.Bottom, FAngle, FAngle);
End ;
Brush.Style := bsSolid ;
if Text <> '' then
begin
if not UseRightToLeftAlignment then
R := Rect(10, 0, 0, H)
else
R := Rect(R.Right - Canvas.TextWidth(Text) - FAngle + 3, 0, 0, H);
Flags := DrawTextBiDiModeFlags(DT_SINGLELINE);
DrawText(Handle, PChar(Text), Length(Text), R, Flags or DT_CALCRECT);
Brush.Color := Color;
If Not Enabled Then
Begin
Font.Color := clBtnHighlight;
R1 := Rect(R.Left + 1, R.Top + 1, R.Right, R.Bottom) ;
DrawText(Handle, PChar(Text), Length(Text), R1, Flags);
Font.Color := clBtnShadow;
Brush.Style := bsClear ;
End ;
DrawText(Handle, PChar(Text), Length(Text), R, Flags);
end;
end;
inherited;
end;
procedure TQGroupBox.CMEnabledChanged(var Message: TMessage);
Var
i: Integer ;
begin
inherited;
Invalidate;
If ControlCount < 1 Then Exit ;
For i := 0 To ControlCount - 1 Do
Begin
Controls.Enabled := Enabled ;
End ;
end;