📄 aqdockinguiofficexp.pas
字号:
hzoLeft:
begin
Exclude(TabBorders, ebTop);
Inc(ARect.Top);
ACanvas.Pixels[ARect.Left + 1, ARect.Top - 1] := DarkColor(TabColor.StartColor);
end;
hzoRight:
begin
Exclude(TabBorders, ebTop);
Inc(ARect.Top);
ACanvas.Pixels[ARect.Right - 1, ARect.Top - 1] := DarkColor(TabColor.StartColor);
end;
end;
end;
DrawRoundEdge(ACanvas, ARect, TabBorders, DarkColor(TabColor.StartColor));
end;
procedure TaqOfficeXPUIStyle.DoDrawHideZone(ACanvas: TCanvas; ASiteRect,
ARect: TRect; AOrientation: TaqHideZoneOrientation);
begin
ACanvas.Brush.Style := bsSolid;
ACanvas.Brush.Color := FToolbarStartColor;
ACanvas.FillRect(ARect);
end;
procedure TaqOfficeXPUIStyle.DoDrawSplitter(ACanvas: TCanvas; ARect: TRect;
AOrientation: TaqSplitterOrientation);
begin
ACanvas.Brush.Style := bsSolid;
ACanvas.Brush.Color := FToolbarStartColor;
ACanvas.FillRect(ARect);
end;
procedure TaqOfficeXPUIStyle.DoDrawTabButton(ACanvas: TCanvas;
ARect: TRect; AState: TaqTabButtonState;
AKind: TaqTabButtonKind);
const
EdgeStyles: array [TaqTabButtonState] of TaqEdgeStyle = (
// tbsNormal, tbsHot, tbsPressed, tbsDisabled
esNone, esFlat, esFlat, esNone);
begin
if AKind = tbkClose then
begin
OffsetRect(ARect, Metrics[dumTabItemBorderX], 0);
ARect.Top := FLastTabTextRect.Top;
ARect.Bottom := FLastTabTextRect.Bottom;
end
else
with ACanvas do
begin
Brush.Style := bsSolid;
Brush.Color := TabPaneColor.StartColor;
FillRect(ARect);
end;
DrawEdge(ACanvas, ARect, EdgeStyles[AState], esNone, ebRect);
InflateRect(ARect, -1, -1);
DoDrawTabButtonWidget(ACanvas, ARect, AState, AKind);
end;
procedure TaqOfficeXPUIStyle.DoDrawTabItem(ACanvas: TCanvas; ARect: TRect;
const ACaption: string; AState: TaqTabItemState;
APosition: TaqTabItemPosition; AOrientation: TaqOrientation;
AButtonAreaWidthBefore: Integer; AButtonAreaWidthAfter: Integer;
ADrawImage: Boolean; AImages: TCustomImageList; AImageIndex: Integer);
const
Borders: array [TaqOrientation] of TaqEdgeBorders = (
[], [ebTop, ebLeft, ebRight], [], [ebBottom, ebLeft, ebRight]
);
var
ActiveTab, SwapColors: Boolean;
Pad: Integer;
TbColor: TGradient;
FillRect: TRect;
TabBorders: TaqEdgeBorders;
begin
Pad := Metrics[dumTabPadding];
ActiveTab := AState in [tisSelected, tisFocused];
if AOrientation = orTop then
begin
Dec(ARect.Bottom, Pad);
Inc(ARect.Top, FMetrics[dumTabTopOffset]);
end
else
begin
Inc(ARect.Top, Pad);
Dec(ARect.Bottom, FMetrics[dumTabTopOffset]);
end;
FillRect := ARect;
if (APosition = tipFirst) or (AState in [tisFocused, tisSelected]) then
Inc(FillRect.Left);
if AOrientation = orTop then
Inc(FillRect.Top)
else
Dec(FillRect.Bottom);
if ActiveTab then
TbColor := ActiveTabColor
else
TbColor := TabColor;
if AOrientation = orTop then
SwapColors := False
else
SwapColors := TbColor.FillType = gtVertical;
TbColor.Fill(ACanvas, FillRect, FillRect, SwapColors);
Inc(ARect.Right);
Inc(FillRect.Left, AButtonAreaWidthBefore);
Dec(FillRect.Right, AButtonAreaWidthAfter);
DoDrawTabItemContent(ACanvas, FillRect, ACaption, AState,
AOrientation, ADrawImage, True, TabFont, ActiveTabFont, AImages, AImageIndex, True);
ACanvas.Pen.Style := psSolid;
TabBorders := Borders[AOrientation];
if (APosition <> tipFirst) and (not (AState in [tisFocused, tisSelected])) then
begin
if AOrientation = orTop then
begin
Exclude(TabBorders, ebLeft);
Inc(ARect.Left);
ACanvas.Pixels[ARect.Left - 1, ARect.Top + 1] := DarkColor(TbColor.StartColor);
end
else
begin
Exclude(TabBorders, ebLeft);
Inc(ARect.Left);
ACanvas.Pixels[ARect.Left - 1, ARect.Bottom - 1] := DarkColor(TabColor.StartColor);
end;
end;
DrawRoundEdge(ACanvas, ARect, TabBorders, DarkColor(TbColor.StartColor));
end;
procedure TaqOfficeXPUIStyle.DoDrawTabPane(ACanvas: TCanvas; ARect: TRect;
AOrientation: TaqTabOrientation);
begin
DoDrawTabPaneContent(ACanvas, ARect, Orientations[AOrientation]);
end;
procedure TaqOfficeXPUIStyle.DoDrawTabTarget(ACanvas: TCanvas;
ARect: TRect);
var
P: TPoint;
begin
ACanvas.Pen.Style := psSolid;
ACanvas.Pen.Color := clWindowText;
ACanvas.Pen.Width := 1;
ACanvas.Brush.Style := bsSolid;
ACanvas.Brush.Color := FDownStartColor;
P := Point(ARect.Left + (ARect.Right - ARect.Left) div 2, ARect.Top + ARect.Right - ARect.Left);
ACanvas.Polygon([ARect.TopLeft, Point(ARect.Right, ARect.Top), P]);
ACanvas.MoveTo(P.X, P.Y);
P.Y := ARect.Bottom - (ARect.Right - ARect.Left);
ACanvas.LineTo(P.X, P.Y);
ACanvas.Polygon([Point(ARect.Left, ARect.Bottom), ARect.BottomRight, P]);
end;
function TaqOfficeXPUIStyle.GetOfficeXPScheme: TaqOfficeXPScheme;
const
MAX_CHARS = 1024;
SStandardThemeFileName = 'LUNA.MSSTYLES';
SBlueColor = 'NORMALCOLOR';
SOliveColor = 'HOMESTEAD';
SSilverColor = 'METALLIC';
var
PThemeFileName, PThemeColor, PThemeSize: PWideChar;
S: string;
begin
Result := ofsDefault;
if FThemeAvailable then
begin
PThemeFileName := AllocMem(SizeOf(WideChar) * MAX_CHARS);
PThemeColor := AllocMem(SizeOf(WideChar) * MAX_CHARS);
PThemeSize := AllocMem(SizeOf(WideChar) * MAX_CHARS);
try
if Assigned(GetCurrentThemeName) and Succeeded(GetCurrentThemeName(PThemeFileName,
MAX_CHARS, PThemeColor, MAX_CHARS, PThemeSize, MAX_CHARS)) and
(UpperCase(ExtractFileName(PThemeFileName)) = SStandardThemeFileName) then
begin
S := UpperCase(PThemeColor);
if S = SBlueColor then
Result := ofsBlue
else if S = SOliveColor then
Result := ofsOlive
else if S = SSilverColor then
Result := ofsSilver;
end;
finally
FreeMem(PThemeSize);
FreeMem(PThemeColor);
FreeMem(PThemeFileName);
end;
end;
end;
procedure TaqOfficeXPUIStyle.SetColors;
var
CurrentScheme: TaqOfficeXPScheme;
ToolbarEndColor: TColorRef;
DownEndColor: TColorRef;
BarMarkStartColor: TColorRef;
BarMarkEndColor: TColorRef;
ModestCaptionStartColor: TColorRef;
begin
BeginUpdate;
try
if FScheme = ofsSystem then
CurrentScheme := GetOfficeXPScheme
else
CurrentScheme := FScheme;
if CurrentScheme <> ofsDefault then
begin
FToolbarStartColor := OfficeXPColors[CurrentScheme, xpToolbarStartColor];
ToolbarEndColor := OfficeXPColors[CurrentScheme, xpToolbarEndColor];
BarMarkStartColor := OfficeXPColors[CurrentScheme, xpBarMarkStartColor];
BarMarkEndColor := OfficeXPColors[CurrentScheme, xpBarMarkEndColor];
FDownStartColor := OfficeXPColors[CurrentScheme, xpDownStartColor];
DownEndColor := OfficeXPColors[CurrentScheme, xpDownEndColor];
ModestCaptionStartColor := BarMarkStartColor;
end
else
begin
FToolbarStartColor := ColorToRGB(clBtnFace);
ToolbarEndColor := GetComplexColor(clBtnFace, clWindow, 20);
BarMarkStartColor := ColorToRGB(clBtnShadow);
BarMarkEndColor := GetComplexColor(clBtnShadow, clWindow, 74);
ModestCaptionStartColor := ColorToRGB(clActiveCaption);
FDownStartColor := GetComplexColor(clBtnFace, clHighlight, clWindow, 41, 11, 48);
DownEndColor := GetComplexColor(clBtnFace, clHighlight, clWindow, 14, 44, 40);
end;
if FSchemeTint = ostFancy then
begin
CaptionFont.Color := clCaptionText;
ActiveCaptionFont.Color := clWindowText;
TabFont.Color := clCaptionText;
HiddenTabFont.Color := clCaptionText;
ActiveHiddenTabFont.Color := clCaptionText;
ActiveCaptionColor.StartColor := FDownStartColor;
ActiveCaptionColor.EndColor := DownEndColor;
ActiveCaptionColor.FillType := gtVertical;
CaptionColor.StartColor := BarMarkEndColor;
CaptionColor.EndColor := BarMarkStartColor;
CaptionColor.FillType := gtVertical;
DownColor.StartColor := FDownStartColor;
DownColor.EndColor := DownEndColor;
DownColor.FillType := gtVertical;
TabPaneColor.StartColor := GetComplexColor(ToolbarEndColor, FToolbarStartColor, 75);
TabPaneColor.EndColor := FToolbarStartColor;
TabPaneColor.FillType := gtVertical;
ActiveTabColor.StartColor := FDownStartColor;
ActiveTabColor.EndColor := DownEndColor;
ActiveTabColor.FillType := gtVertical;
ActiveHiddenTabColor.StartColor := BarMarkStartColor;
ActiveHiddenTabColor.EndColor := BarMarkEndColor;
ActiveHiddenTabColor.FillType := gtVertical;
TabColor.StartColor := BarMarkStartColor;
TabColor.EndColor := BarMarkEndColor;
TabColor.FillType := gtVertical;
HiddenTabColor.StartColor := BarMarkStartColor;
HiddenTabColor.EndColor := BarMarkEndColor;
HiddenTabColor.FillType := gtVertical;
end
else
begin
CaptionFont.Color := clWindowText;
ActiveCaptionFont.Color := clCaptionText;
TabFont.Color := clWindowText;
HiddenTabFont.Color := clWindowText;
ActiveHiddenTabFont.Color := clWindowText;
ActiveCaptionColor.StartColor := ModestCaptionStartColor;
ActiveCaptionColor.EndColor := GetComplexColor(ToolbarEndColor, FToolbarStartColor, 75);
ActiveCaptionColor.FillType := gtHorizontal;
CaptionColor.StartColor := clBtnFace;
CaptionColor.EndColor := FToolbarStartColor;
CaptionColor.FillType := gtHorizontal;
FCaptionButtonSelColor := GetRealColor(GetComplexColor(CaptionColor.StartColor, clHighlight, clWindow, -2, 30, 72));
TabPaneColor.StartColor := GetComplexColor(clBtnFace, clWindow, 20);
TabPaneColor.EndColor := TabPaneColor.StartColor;
TabPaneColor.FillType := gtSolid;
ActiveTabColor.StartColor := NETBackColor(clWindow);
ActiveTabColor.FillType := gtSolid;
ActiveHiddenTabColor.StartColor := CaptionColor.EndColor;
ActiveHiddenTabColor.EndColor := CaptionColor.StartColor;
ActiveHiddenTabColor.FillType := gtVertical;
TabColor.StartColor := CaptionColor.EndColor;
TabColor.EndColor := CaptionColor.StartColor;
TabColor.FillType := gtVertical;
HiddenTabColor.StartColor := CaptionColor.EndColor;
HiddenTabColor.EndColor := CaptionColor.StartColor;
HiddenTabColor.FillType := gtVertical;
end;
finally
EndUpdate;
end;
end;
procedure TaqOfficeXPUIStyle.SetDownColor(const Value: TGradient);
begin
if Value <> nil then
FDownColor.Assign(Value)
else
FDownColor.Clear;
end;
procedure TaqOfficeXPUIStyle.SetScheme(const Value: TaqOfficeXPScheme);
begin
if FScheme <> Value then
begin
FScheme := Value;
SetColors;
Change;
end;
end;
procedure TaqOfficeXPUIStyle.SetSchemeTint(
const Value: TaqOfficeXPSchemeTint);
begin
if FSchemeTint <> Value then
begin
FSchemeTint := Value;
SetColors;
Change;
end;
end;
procedure TaqOfficeXPUIStyle.ThemeChange(Sender: TObject);
begin
CheckTheme;
Change;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -