📄 spanel.pas
字号:
if (Message.Msg = WM_SETTEXT) and not RestrictDrawing then sStyle.BGChanged := True;
if Assigned(FsStyle) then FsStyle.WndProc(Message);
if Message.Result <> 1 then inherited;
end;
procedure TsCustomPanel.CreateWnd;
begin
inherited;
end;
procedure TsCustomPanel.Invalidate;
begin
if Assigned(FsStyle) and (FsStyle.Painting.FBevel <> BevelOuter) then begin
FsStyle.Painting.FBevel := BevelOuter;
end;
inherited;
end;
procedure TsCustomPanel.SetBevelInner(const Value: TsControlBevel);
begin
if FBevelInner <> Value then begin
FBevelInner := Value;
sStyle.Invalidate;
end;
end;
procedure TsCustomPanel.SetBevelOuter(const Value: TsControlBevel);
begin
if FBevelOuter <> Value then begin
FBevelOuter := Value;
sStyle.Invalidate;
end;
end;
function TsCustomPanel.Margin: integer;
begin
Result := BorderWidth;
if sStyle.ActualBevel <> cbNone then inc(Result, BevelWidth);
if BevelInner <> cbNone then inc(Result, BevelWidth);
end;
procedure TsCustomPanel.AfterConstruction;
begin
inherited;
sStyle.Loaded;
end;
procedure TsCustomPanel.Loaded;
begin
inherited;
sStyle.Loaded;
end;
procedure TsCustomPanel.PaintSkinBorder(index: integer);
var
Mode : integer;
begin
if sStyle.ControlIsActive then begin
Mode := 1;
end
else begin
Mode := 0;
end;
PaintRasterBorder(sStyle.FCacheBmp, ma[index].Bmp, Mode, sStyle.FRegion, ma[index].TransparentColor, False);
end;
{ TsPanel }
constructor TsPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
sStyle.COC := COC_TsPanel;
if (csDesigning in ComponentState) and (sStyle.Background.Gradient.Data = '') then begin
sStyle.Background.Gradient.Data := GradientTsPanel;
end;
end;
{$IFNDEF ALITE}
{ TsContainer }
constructor TsContainer.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
sStyle.COC := COC_TsContainer;
BorderStyle := bsSingle;
BevelOuter := cbNone;
if (csDesigning in ComponentState) and (sStyle.Background.Gradient.Data = '') then begin
sStyle.Background.Gradient.Data := GradientTsContainer;
end;
end;
{ TsGlassPanel }
constructor TsGlassPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
sStyle.COC := COC_TsGlassPanel;
FMask := TPicture.Create;
end;
procedure TsGlassPanel.SetMask(const Value: TPicture);
begin
if Assigned(Value) then begin
FMask.Assign(Value);
FMask.Bitmap.PixelFormat := pf24bit;
FMask.Bitmap.Monochrome := True;
end
else begin
FMask.Assign(nil);
end;
sStyle.Invalidate;
end;
procedure TsGlassPanel.Paint;
var
R: TRect;
b : boolean;
Transparency : integer;
begin
if (csDestroying in ComponentState) or (csLoading in ComponentState) then Exit;
b := True;
Color := ColorToRGB(sStyle.Painting.Color);
R := ClientRect;
sStyle.InitCacheBmp;
if sStyle.SkinIndex > -1 then begin
Transparency := gd[sStyle.SkinIndex].PaintingTransparency;
end
else begin
Transparency := sStyle.Painting.Transparency;
end;
BlendColorRect(sStyle.FCacheBmp,
Rect(0, 0, Width, Height),
Transparency,
Color);
// FadeRect(sStyle.FCacheBmp.Canvas, Rect(0, 0, Width, Height), sStyle.FCacheBmp.Canvas.Handle, Point(0, 0), Transparency, Color, 0, ssRectangle);
WriteText(R, sStyle);
DrawGlassBorders;
Canvas.CopyRect(ClientRect, sStyle.FCacheBmp.Canvas, ClientRect);
RepaintsControls(Self, b);
end;
procedure TsGlassPanel.DrawGlassBorders;
begin
//
end;
{ TsToolBar }
procedure TsToolBar.AdjustSize;
var
aRect, NewRect : TRect;
// ParBorder : integer;
function GetMaxRect : TRect; var i: integer; begin
Result.Left := 2048;
Result.Top := 1536;
Result.Right := 0;
Result.Bottom := 0;
for i := 0 to ControlCount - 1 do begin
if Controls[i] is TControl then begin
Result.Left := Mini(TControl(Controls[i]).Left, Result.Left);
Result.Right := Maxi(TControl(Controls[i]).Left + TControl(Controls[i]).Width, Result.Right);
Result.Top := Mini(TControl(Controls[i]).Top, Result.Top);
Result.Bottom := Maxi(TControl(Controls[i]).Top + TControl(Controls[i]).Height, Result.Bottom);
end;
end;
aRect.Right := Maxi(aRect.Right, aRect.Left + 12);
aRect.Bottom := Maxi(aRect.Bottom, aRect.Top + 12);
if sStyle.ActualBevel <> cbNone then begin
InflateRect(Result, sStyle.ActualBevelWidth, sStyle.ActualBevelWidth);
end;
if BevelInner <> cbNone then begin
InflateRect(Result, sStyle.ActualBevelWidth, sStyle.ActualBevelWidth);
end;
InflateRect(Result, BorderWidth, BorderWidth);
end;
begin
{ SetWindowPos(Handle, 0, 0, 0, Width, Height, SWP_NOACTIVATE or SWP_NOMOVE or
SWP_NOZORDER);
RequestAlign;}
//inherited;
NewRect := BoundsRect;
SetBounds(NewRect.Left, NewRect.Top, NewRect.Right - NewRect.Left, NewRect.Bottom - NewRect.Top);
RequestAlign;
end;
constructor TsToolBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FButtons := TsToolButtons.Create(Self);
sStyle.COC := COC_TsToolBar;
Caption := ' ';
DontAutoSize := False;
BorderWidth := 2;
if (csDesigning in ComponentState) and (sStyle.Background.Gradient.Data = '') then begin
sStyle.Background.Gradient.Data := GradientTsToolBar;
end;
end;
destructor TsToolBar.Destroy;
begin
if Assigned(FButtons) then FreeAndNil(FButtons);
inherited;
end;
procedure TsToolBar.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if Operation = opRemove then begin
if Assigned(FButtons) then begin
if AComponent = Buttons.Images
then Buttons.FImages := nil
else if AComponent = Buttons.FImagesGrayed
then Buttons.FImagesGrayed := nil
else if AComponent = Buttons.FImagesDisabled
then Buttons.FImagesDisabled := nil;
end
end;
end;
{ TsDragBar }
constructor TsDragBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
sStyle.COC := COC_TsDragBar;
Caption := ' ';
sStyle.Background.Gradient.Data := GradientTsDragBar;
sStyle.Effects.Shadow.Enabled := True;
Align := alTop;
Height := 20;
Font.Color := clCaptionText;
Font.Style := [fsBold];
Cursor := crHandPoint;
end;
procedure TsDragBar.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited MouseDown(Button, Shift, x, y);
if (Button = mbLeft) and (FDraggedControl <> nil) then begin
ReleaseCapture;
FDraggedControl.Perform(WM_SYSCOMMAND, $F012, 0);
end
end;
procedure TsDragBar.ReadState(Reader: TReader);
begin
if (Reader.Parent <> nil) and (DraggedControl = nil) then
DraggedControl := GetParentForm(TControl(Reader.Parent));
inherited ReadState(Reader);
end;
procedure TsDragBar.WMActivateApp(var Message: TWMActivateApp);
begin
if Message.Active then begin
Font.Color := clActiveCaption;
end
else begin
Font.Color := clInActiveCaption;
end;
end;
{ TsToolButtons }
constructor TsToolButtons.Create(AOwner: TsToolBar);
begin
FOwner := AOwner;
FButtonHeight := 32;
FButtonWidth := 32;
FGrayed := False;
end;
procedure TsToolButtons.SetGrayed(const Value: boolean);
var
i : integer;
begin
if FGrayed <> Value then begin
FGrayed := Value;
for i := 0 to FOwner.ControlCount - 1 do begin
if (FOwner.Controls[i] is TsSpeedButton) then begin
TsSpeedButton(FOwner.Controls[i]).Grayed := Value;
end;
end;
FOwner.sStyle.Invalidate;
end;
end;
procedure TsToolButtons.SetImages(const Index: Integer; const Value: TCustomImageList);
var
i : integer;
begin
case Index of
0: begin
FImages := Value;
for i := 0 to FOwner.ControlCount - 1 do begin
if (FOwner.Controls[i] is TsSpeedButton) and (TsSpeedButton(FOwner.Controls[i]).Images = nil) then begin
TsSpeedButton(FOwner.Controls[i]).Images := Value;
// TsSpeedButton(Controls[i])
end;
end;
end;
1: begin
FImagesGrayed := Value;
for i :=0 to FOwner.ControlCount - 1 do begin
if (FOwner.Controls[i] is TsSpeedButton) and (TsSpeedButton(FOwner.Controls[i]).ImagesGrayed = nil) then begin
TsSpeedButton(FOwner.Controls[i]).ImagesGrayed := Value;
end;
end;
end;
2: begin
FImagesDisabled := Value;
for i :=0 to FOwner.ControlCount - 1 do begin
if (FOwner.Controls[i] is TsSpeedButton) and (TsSpeedButton(FOwner.Controls[i]).ImagesDisabled = nil) then begin
TsSpeedButton(FOwner.Controls[i]).ImagesDisabled := Value;
end;
end;
end;
end;
end;
procedure TsToolButtons.SetShowCaptions(const Value: boolean);
var
i : integer;
begin
if FShowCaptions <> Value then begin
FShowCaptions := Value;
for i :=0 to FOwner.ControlCount - 1 do begin
if FOwner.Controls[i] is TsSpeedButton then begin
TsSpeedButton(FOwner.Controls[i]).ShowCaption := Value;
end;
end;
end;
end;
{$ENDIF}
{ TsGrip }
constructor TsGrip.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
// sStyle.COC := COC_TsGrip;
// sStyle.skinSection :=
Caption := ' ';
sStyle.SkinSection := 'TSGRIP';
sStyle.Background.Gradient.Data := ' ';
Align := alNone;
Height := 20;
Width := 20;
// Cursor := crSizeNWSE;
end;
procedure TsGrip.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
if (Button = mbLeft) and (LinkedControl <> nil) then begin
ReleaseCapture;
SendMessage(LinkedControl.Handle, WM_COMMAND, SC_MOVE, 0);
// LinkedControl.Perform(WM_SYSCOMMAND, $F012, 0);
end else inherited;
end;
procedure TsGrip.Paint;
begin
if not ControlIsReady(Self) then Exit;
sStyle.BGChanged := True;
inherited;
BringToFront;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -