⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dxribbonskins.pas

📁 胜天进销存源码,国产优秀的进销存
💻 PAS
📖 第 1 页 / 共 5 页
字号:
  begin
    //todo:
    if AIsLowered then
      Parts[FStatusBarPanelLowered].Draw(DC, R)
    else
      Parts[FStatusBarPanelRaised].Draw(DC, R);
  end;
end;

procedure TdxCustomRibbonSkin.DrawStatusBarPanelSeparator(DC: HDC;
  const R: TRect);
begin
  if FLowColors then
  begin
    FillRectByColor(DC, R, clBtnFace);
    FillRectByColor(DC, cxRect(R.Left, R.Top + 1, R.Left + 1, R.Bottom - 1), clBtnShadow);
  end
  else
    Parts[FStatusBarPanelSeparator].Draw(DC, R);
end;

procedure TdxCustomRibbonSkin.DrawStatusBarSizeGrip(DC: HDC; const R: TRect);
begin
  Office11DrawSizeGrip(DC, R, GetPartColor(rspStatusBarSizeGripColor1),
    GetPartColor(rspStatusBarSizeGripColor2));
end;

procedure TdxCustomRibbonSkin.DrawStatusBarToolbarSeparator(DC: HDC; const R: TRect);
begin
  if FLowColors then
  begin
    FillRectByColor(DC, R, clBtnFace);
    FillRectByColor(DC, cxRect(R.Left, R.Top, R.Left + 1, R.Bottom - 1), clBtnShadow);
  end
  else
    Parts[FStatusBarToolbarSeparator].Draw(DC, R);
end;

function TdxCustomRibbonSkin.GetApplicationMenuGlyphSize: TSize;
begin
  Result := cxSize(42, 42);
end;

function TdxCustomRibbonSkin.GetSkinName: string;
begin
  Result := '';
end;

function TdxCustomRibbonSkin.GetCaptionFontSize(ACurrentFontSize: Integer): Integer;
begin
  Result := ACurrentFontSize;
end;

function TdxCustomRibbonSkin.GetMenuSeparatorSize: Integer;
begin
  Result := 2;
end;

function TdxCustomRibbonSkin.GetPartColor(APart: Integer; AState: Integer = 0): TColor;
begin
  Result := clDefault;
  if LowColors then
  begin
    case APart of
      //!!!TODO:
      DXBAR_APPLICATIONMENUCONTENTSIDES: Result := $EDD3BE;
      DXBAR_APPLICATIONMENUCONTENTOUTERBORDER: Result := clWhite;
      DXBAR_APPLICATIONMENUCONTENTINNERBORDER: Result := $CAAF9B;
      DXBAR_MENUEDITSEPARATOR:
        case AState of
          DXBAR_ACTIVE:  Result := $85B6CA;
          DXBAR_ACTIVEDISABLED:  Result := $CDCDCD;
        end;
      DXBAR_SCREENTIP_FOOTERLINE:
        Result := $DDBB9E;
      DXBAR_DATENAVIGATOR_HEADER:
        Result := $DAD5D2;
      DXBAR_SEPARATOR_BACKGROUND:
        Result := $EFE7DE;
      rspRibbonBottomEdge:
        Result := $F3E2D5;
      DXBAR_EDIT_BORDER, DXBAR_EDIT_BUTTON_BORDER:
        case AState of
          DXBAR_NORMAL, DXBAR_DISABLED: Result := clBtnShadow;
        else
          Result := clWhite;
        end;
      DXBAR_EDIT_BACKGROUND:
        Result := clBtnFace;
      rspFormCaptionText, rspDocumentNameText:
        if AState = DXBAR_NORMAL then
          Result := clCaptionText
        else
          Result := clInactiveCaptionText;
      rspTabHeaderText:
        if AState = DXBAR_NORMAL then
          Result := clWindowText
        else
          Result := clHighlightText;
      rspTabGroupHeaderText:
        Result := clWindowText;
      DXBAR_ITEMTEXT, rspTabGroupText, rspStatusBarText:
        case AState of
          DXBAR_NORMAL:
            Result := clWindowText;
          DXBAR_DISABLED:
            Result := clGrayText;
          else
            Result := clHighlightText;
        end;
      DXBAR_MENUITEMTEXT, DXBAR_GALLERYGROUPHEADERTEXT:
        case AState of
          DXBAR_NORMAL:
            Result := clMenuText;
          DXBAR_DISABLED:
            Result := clGrayText;
          else
            Result := clHighlightText;
        end;
      DXBAR_GALLERYGROUPITEM_OUTERBORDER, DXBAR_GALLERYGROUPITEM_INNERBORDER:
        Result := clHighlight;
      rfspRibbonForm:
        Result := clBtnShadow;
    else
      Result := clBtnFace;
    end;
    Result := ColorToRGB(Result);
  end
  else
    case APart of
      DXBAR_GALLERYGROUPHEADERTEXT: Result := GetPartColor(DXBAR_MENUITEMTEXT);
      DXBAR_MENUEXTRAPANE: Result := $EEEAE9;
      DXBAR_MENUARROWSEPARATOR: Result := $BDB6A5;
      DXBAR_MENUDETACHCAPTIONAREA: Result := $F7F7F7;
      DXBAR_MENUITEMTEXT:
        if AState in [DXBAR_DISABLED, DXBAR_ACTIVEDISABLED] then
          Result := $A7A7A7;
      DXBAR_ITEMTEXT:
        case AState of
          DXBAR_DISABLED, DXBAR_ACTIVEDISABLED: Result := $8D8D8D;
        else
          Result := GetPartColor(rspTabGroupText);
        end;
      DXBAR_DROPDOWNGALLERY: Result := $FAFAFA;
      DXBAR_DROPDOWNBORDER_INNERLINE: Result := $F5F5F5;
      DXBAR_GALLERYGROUPITEM_OUTERBORDER:
        case AState of
          DXBAR_HOT: Result := $3694F2;
          DXBAR_CHECKED: Result := $1048EF;
          DXBAR_HOTCHECK: Result := $3695F2;
        end;
      DXBAR_GALLERYGROUPITEM_INNERBORDER:
        case AState of
          DXBAR_HOT: Result := $94E2FF;
          DXBAR_CHECKED: Result := $94E2FF;
          DXBAR_HOTCHECK: Result := $95E3FF;
        end;
    end;
end;

function TdxCustomRibbonSkin.GetPartContentOffsets(APart: Integer): TRect;
begin
  Result := cxNullRect;
end;

function TdxCustomRibbonSkin.GetQuickAccessToolbarMarkButtonOffset(
  AHasApplicationButton: Boolean; ABelow: Boolean): Integer;
begin
  if ABelow then
    Result := 5
  else
    Result := 12;
end;

function TdxCustomRibbonSkin.GetQuickAccessToolbarOverrideWidth(
  AHasApplicationButton: Boolean; AUseAeroGlass: Boolean): Integer;
begin
  if AHasApplicationButton then
    Result := 14
  else
    Result := 0;
end;

function TdxCustomRibbonSkin.GetQuickAccessToolbarLeftIndent(
  AHasApplicationButton: Boolean; AUseAeroGlass: Boolean): Integer;
begin
  Result := 0;
end;

function TdxCustomRibbonSkin.GetQuickAccessToolbarRightIndent(
  AHasApplicationButton: Boolean): Integer;
begin
  Result := 0;
end;

function TdxCustomRibbonSkin.GetWindowBordersWidth(AHasStatusBar: Boolean): TRect;
begin
  Result := cxRect(4, 0, 4, 4);
  if AHasStatusBar then
    Result.Bottom := 1;
end;

function TdxCustomRibbonSkin.HasGroupTransparency: Boolean;
begin
  Result := False;
end;

function TdxCustomRibbonSkin.NeedDrawGroupScrollArrow: Boolean;
begin
  Result := True;
end;

procedure TdxCustomRibbonSkin.UpdateBitsPerPixel;
var
  DC: HDC;
begin
  DC := GetDC(0);
  FLowColors := GetDeviceCaps(DC, BITSPIXEL) <= 8;
  ReleaseDC(0, DC);
end;

procedure TdxCustomRibbonSkin.LoadCommonControlSkinFromBitmap(ABitmap: GpBitmap);

  procedure AddElement(var AParts; const R, F: TRect; ID: Integer;
    AInterpolationMode: Integer = InterpolationModeNearestNeighbor);
  begin
    LoadElementParts(ABitmap, AParts, R, ID, F, [0], [0]);
    Parts[Integer(AParts)].InterpolationMode := AInterpolationMode;
  end;

begin
  AddElement(FQATGlassAtTopLeft[True], cxRectBounds(0, 353, 16, 26), cxRect(0, 2, 2, 2),
    rspQATNonClientLeft1Vista, InterpolationModeHighQualityBicubic);
  AddElement(FQATGlassAtTopLeft[False], cxRectBounds(34, 353, 4, 26), cxRect(2, 2, 0, 2),
    rspQATNonClientLeft2Vista, InterpolationModeHighQualityBicubic);
  AddElement(FQATGlassAtTopRight, cxRectBounds(16, 353, 18, 26), cxRect(0, 7, 15, 7),
    rspQATNonClientRightVista, InterpolationModeHighQualityBicubic);
  LoadCommonButtonParts(ABitmap);
  LoadCommonMenuParts(ABitmap);
  LoadCommonProgressParts(ABitmap);
  FHelpButton := AddPart1x1(ABitmap, cxRectBounds(42, 353, 16, 16), rspHelpButton, '', 7);
end;

procedure TdxCustomRibbonSkin.LoadCustomControlSkinFromBitmap(ABitmap: GpBitmap);
begin
  LoadTab(ABitmap);
  LoadScrollButtons(ABitmap);
  LoadCustomGroup(ABitmap);
  LoadCollapsedToolbar(ABitmap);
  LoadCustomButtonParts(ABitmap);
  LoadCustomMenuParts(ABitmap);
  LoadCustomProgressParts(ABitmap);
  LoadCustomScrollArrow(ABitmap);
  LoadCustomScreenTip(ABitmap);
  LoadQAT(ABitmap);
  LoadStatusBar(ABitmap);
  LoadGallery(ABitmap);
end;

procedure TdxCustomRibbonSkin.LoadFormSkinFromBitmap(ABitmap: GpBitmap);

  procedure AddElement(var AParts; const R, F: TRect; ID: Integer;
    AInterpolationMode: Integer = InterpolationModeNearestNeighbor);
  begin
    LoadElementParts(ABitmap, AParts, R, ID, F, [0, 1], [0, 1]);
    Parts[TTwoStateArray(AParts)[False]].InterpolationMode := AInterpolationMode;
    Parts[TTwoStateArray(AParts)[True]].InterpolationMode := AInterpolationMode;
  end;

var
  R, Fixed: TRect;
begin
  //caption
  AddElement(FCaption, cxRectBounds(0, 37, 14, 31), cxRect(6, 10, 6, 5), rfspActiveCaption);
  AddElement(FCaptionZoomed, cxRectBounds(6, 37, 2, 31), cxRect(0, 10, 0, 5), rfspActiveCaptionZoomed);
  //caption borders
  R := cxRectBounds(0, 37, 4, 31);
  Fixed := cxRect(0, 9, 0, 2);
  AddElement(FCaptionLeftBorder, R, Fixed, rfspActiveCaptionLeftBorder);
  OffsetRect(R, 10, 0);
  AddElement(FCaptionRightBorder, R, Fixed, rfspActiveCaptionRightBorder);
  //active border
  R := cxRectBounds(15, 37, 4, 6);
  Fixed := cxRect(0, 0, 0, 5);
  AddElement(FLeftBorder, R, Fixed, rfspActiveLeftBorder);
  OffsetRect(R, 5, 0);
  AddElement(FRightBorder, R, Fixed, rfspActiveRightBorder);
  //bottom border
  AddElement(FBottomBorderThin, cxRectBounds(15, 50, 2, 2), cxEmptyRect, rfspActiveBottomBorder1);
  AddElement(FBottomBorderThick[False], cxRectBounds(40, 113, 10, 4), cxRect(4, 0, 4, 0), rfspActiveBottomBorder2);
  AddElement(FBottomBorderThick[True], cxRectBounds(40, 121, 10, 4), cxRect(4, 0, 4, 0), rfspActiveBottomBorder3);
  LoadBorderIcons(ABitmap);
  //QuickAccessToolbar non-client
  AddElement(FQATAtTopLeft[True], cxRectBounds(0, 113, 15, 26), cxRect(13, 5, 0, 5),
    rspQATNonClientLeft1Active);
  AddElement(FQATAtTopLeft[False], cxRectBounds(32, 113, 7, 26), cxRect(2, 5, 0, 5),
    rspQATNonClientLeft2Active);
  AddElement(FQATAtTopRight, cxRectBounds(13, 113, 18, 26), cxRect(0, 5, 13, 5),
    rspQATNonClientRightActive);

  FRibbonTopArea := AddPart3x3(ABitmap, cxRectBounds(6, 38, 2, 30), cxRect(0, 9, 0, 5), rspRibbonClientTopArea);
  LoadApplicationButton(ABitmap);
end;

procedure TdxCustomRibbonSkin.DrawApplicationButtonLC(DC: HDC; const R: TRect;
  AState: TdxApplicationButtonState);
var
  ARect: TRect;
  AIndex: Integer;
  APen: HPEN;
  ABrush: HBRUSH;
  AColor: TColor;
  B: TLogBrush;
begin
  AIndex := SaveDC(DC);
  if AState <> absPressed then
    AColor := ColorToRgb(clWhite)
  else
    AColor := ColorToRgb(clBtnShadow);
  APen := CreatePen(PS_SOLID, 3, AColor);
  if AState = absNormal then
    AColor := ColorToRgb(clBtnFace)
  else
    AColor := ColorToRgb(clHighlight);
  ABrush := CreateSolidBrush(AColor);
  ARect := cxRectInflate(R, -1, -1);
  Dec(ARect.Right);
  Dec(ARect.Bottom);
  SelectObject(DC, APen);
  SelectObject(DC, ABrush);
  Ellipse(DC, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom);
  DeleteObject(ABrush);
  DeleteObject(APen);
  APen := CreatePen(PS_SOLID, 1, 0);
  B.lbStyle := BS_NULL;
  B.lbColor := 0;
  B.lbHatch := 0;
  ABrush := CreateBrushIndirect(B);
  SelectObject(DC, APen);
  SelectObject(DC, ABrush);
  Ellipse(DC, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom);
  DeleteObject(ABrush);
  DeleteObject(APen);
  RestoreDC(DC, AIndex);
end;

procedure TdxCustomRibbonSkin.DrawApplicationMenuBorderLC(DC: HDC;
  const R: TRect);
begin
  DrawFrame(DC, R, clMenu, clBlack);
end;

procedure TdxCustomRibbonSkin.DrawBlackArrow(DC: HDC; const R: TRect; AArrowDirection: TcxArrowDirection);
var
  APoints: TcxArrowPoints;
  ARgn: HRGN;
begin
  TcxCustomLookAndFeelPainter.CalculateArrowPoints(R, APoints, AArrowDirection, False, 4)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -