dxskininfo.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,197 行 · 第 1/4 页

PAS
1,197
字号
    EditorTextColors[False] := GetColorByName(Group_Editors, sdxSkinsEditorTextColor);
    EditorTextColors[True] := GetColorByName(Group_Editors, sdxSkinsEditorTextDisabledColor);

    HeaderBackgroundColor := Skin.GetColorByName(sdxSkinsHeaderBackgroundColor);
    HeaderBackgroundTextColor := Skin.GetColorByName(sdxSkinsHeaderBackgroundTextColor);
    LayoutControlColor := Skin.GetColorByName(sdxSkinsLayoutControlColor);
    SelectionColor := Skin.GetColorByName(sdxSkinsSelectionColor);
    SelectionTextColor := Skin.GetColorByName(sdxSkinsSelectionTextColor);
  end;
end;

procedure TdxSkinInfo.InitializeDockControlElements;
begin
  DockControlTabHeaderBackground := GetElementByName(Group_Docking,
    sdxDockCtrlTabHeaderBackground);
  DockControlTabHeaderLine := GetElementByName(Group_Docking,
    sdxDockCtrlTabHeaderLine);
  DockControlHideBarButtons := GetElementByName(Group_Docking,
    sdxDockCtrlTabHeaderAutoHideBar);
  DockControlWindowButton := GetElementByName(Group_Docking, sdxDockCtrlWindowButton);
  DockControlWindowButtonGlyphs := GetElementByName(Group_Docking, sdxDockCtrlWindowGlyphs);
  DockControlTabHeader := GetElementByName(Group_Docking, sdxDockCtrlTabHeader);
  DockControlHideBar := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBar);
  DockControlHideBarLeft := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBarLeft);
  DockControlHideBarRight := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBarRight);
  DockControlHideBarBottom := GetElementByName(Group_Docking, sdxDockCtrlAutoHideBarBottom);

  DockControlCaption := GetElementByName(Group_Docking, sdxDockCtrlCaption);
  DockControlBorder := GetElementByName(Group_Docking, sdxDockCtrlBorder);
  DockControlCaptionNonFocusedTextColor := GetElementColorProperty(DockControlCaption,
    sdxDockCtrlInactiveCaptionTextColor);
    
  FillChar(DockControlIndents, SizeOf(DockControlIndents), 0);
  if Group_Docking <> nil then
  begin
    DockControlIndents[0] := GetElementIntProperty(Group_Docking, sdxDCActiveTabHeaderDownGrow);
    DockControlIndents[1] := GetElementIntProperty(Group_Docking, sdxDCActiveTabHeaderHGrow);
    DockControlIndents[2] := GetElementIntProperty(Group_Docking, sdxDCActiveTabHeaderUpGrow);
  end;
end;

procedure TdxSkinInfo.InitializeEditButtonElements;
var
  AKind: TcxEditBtnKind;
begin
  EditButtonElements[False] := GetElementByName(Group_Editors, sdxEditorButton);
  EditButtonElements[True] := GetElementByName(Group_Editors, sdxCloseButton);
  for AKind := Low(TcxEditBtnKind) to High(TcxEditBtnKind) do
    EditButtonGlyphs[AKind] := GetElementByName(Group_Editors, EditButtonsMap[AKind]);
end;

procedure TdxSkinInfo.InitializeFilterElements;
begin
  FilterButtons[False] := GetElementByName(Group_Grid, sdxFilterButton);
  FilterButtons[True] := GetElementByName(Group_Grid, sdxFilterButtonActive);
  FilterPanel := GetElementByName(Group_Grid, sdxFilterPanel);
end;

procedure TdxSkinInfo.InitializeFooterElements;
begin
  FooterCell := GetElementByName(Group_Grid, sdxFooterCell);
  FooterPanel := GetElementByName(Group_Grid, sdxFooterPanel);
end;

procedure TdxSkinInfo.InitializeFormElements;

  procedure CorrectStateAndStretch(AElement: TdxSkinElement;
    AInclude, AExclude: TdxSkinElementStates; AStretch: Boolean = False);
  begin
    if AElement = nil then Exit;
    AElement.Image.States := AElement.Image.States + AInclude - AExclude;
    if AStretch then
      AElement.Image.Stretch := smStretch;
  end;

  function CorrectElementMargins(const R: TRect; ASize: TSize; ASide: TcxBorder): TRect;
  begin
    Result := R;
    case ASide of
      bLeft:
        if ASize.cx = 1 then
        begin
          Result.Left := 1;
          Result.Right := 0;
        end;
      bRight:
        if ASize.cx = 1 then
        begin
          Result.Right := 1;
          Result.Left := 0;
        end;
      bBottom:
        if ASize.cy = 1 then
        begin
          Result.Top := 0;
          Result.Bottom := 1;
        end;
    end;
  end;

  procedure GetFormBorderSize(var R: TRect; const AElement: TdxSkinElement;
    ASide: TcxBorder);
  begin
    if AElement = nil then Exit;
    case ASide of
      bLeft:
        R.Left := AElement.Size.cx;
      bRight:
        R.Right := AElement.Size.cx;
      bBottom:
        R.Bottom := AElement.Size.cy;
    end;
  end;

var
  R: TRect;
  ASide: TcxBorder;
  AStandard: Boolean;
  AIcon: TdxSkinFormIcon;
begin
  FillChar(FormIcons, SizeOf(FormIcons), 0);
  FormInactiveColor := GetColorByName(Group_Form, sdxTextInactiveColor);
  FormTextShadowColor := GetColorByName(Group_Form, sdxTextShadowColor);
  FormStatusBar := GetElementByName(Group_Bars, sdxStatusBar);
  FormIcons[False, sfiClose] := GetElementByName(Group_Form, sdxSmallFormButtonClose);
  FormIcons[True, sfiClose] := GetElementByName(Group_Form, sdxFormButtonClose);
  FormIcons[True, sfiMinimize] := GetElementByName(Group_Form, sdxFormButtonMinimize);
  FormIcons[True, sfiMaximize] := GetElementByName(Group_Form, sdxFormButtonMaximize);
  FormIcons[True, sfiRestore] := GetElementByName(Group_Form, sdxFormButtonRestore);
  FormIcons[True, sfiHelp] := GetElementByName(Group_Form, sdxFormButtonHelp);
  FormContent := GetElementByName(Group_Form, sdxFormContent);

  for AStandard := False to True do
    for ASide := Low(TcxBorder) to High(TcxBorder) do
      FormFrames[AStandard, ASide] := GetElementByName(Group_Form,
        FormFrameMap[AStandard, ASide]);

  if Skin = nil then Exit;  
  Skin.BeginUpdate;
  try
    for AStandard := False to True do
    begin
      R := cxNullRect;
      for AIcon := sfiMenu to sfiClose do
        CorrectStateAndStretch(FormIcons[AStandard, AIcon],
          [esActiveDisabled], [esActive], True);
          
      for ASide := Low(TcxBorder) to High(TcxBorder) do
        if FormFrames[AStandard, ASide] <> nil then
        begin
          CorrectStateAndStretch(FormFrames[AStandard, ASide],
            [esActive, esActiveDisabled], [esNormal]);
          GetFormBorderSize(R, FormFrames[AStandard, ASide], ASide);
          with FormFrames[AStandard, ASide].Image do
            Margins.Rect := CorrectElementMargins(Margins.Rect, Size, ASide);
        end;
      FormBorderWidths[AStandard] := R;
    end;
    FormCaptionDelta := Max(1, 
      GetElementIntProperty(FormFrames[True, bTop], sdxCaptionFontDelta));
  finally
    Skin.CancelUpdate;
  end;
end;

procedure TdxSkinInfo.InitializeGroupBoxElements;
begin
  GroupBoxClient := GetElementByName(Group_Common, sdxGroupPanelNoBorder);
  GroupBoxElements[cxgpTop] := GetElementByName(Group_Common, sdxGroupPanelTop);
  GroupBoxElements[cxgpBottom] := GetElementByName(Group_Common, sdxGroupPanelBottom);
  GroupBoxElements[cxgpLeft] := GetElementByName(Group_Common, sdxGroupPanelLeft);
  GroupBoxElements[cxgpRight] := GetElementByName(Group_Common, sdxGroupPanelRight);
  GroupBoxElements[cxgpCenter] := GetElementByName(Group_Common, sdxGroupPanel);

  GroupBoxCaptionElements[cxgpTop] := GetElementByName(Group_Common, sdxGroupPanelCaptionTop);
  GroupBoxCaptionElements[cxgpBottom] := GetElementByName(Group_Common, sdxGroupPanelCaptionBottom);
  GroupBoxCaptionElements[cxgpLeft] := GetElementByName(Group_Common, sdxGroupPanelCaptionLeft);
  GroupBoxCaptionElements[cxgpRight] := GetElementByName(Group_Common, sdxGroupPanelCaptionRight);
end;

procedure TdxSkinInfo.InitializeGridElements;
begin
  GridFixedLine := GetElementByName(Group_Grid, sdxGridFixedLine);
  CardViewSeparator := GetElementByName(Group_Grid, sdxCardSeparator);
  GridGroupByBox := GetElementByName(Group_Grid, sdxGroupByBox);
  if (GridGroupByBox <> nil) and not GridGroupByBox.Image.Empty then
    GridGroupByBox.Color := clNone;
  GridGroupRow := GetElementByName(Group_Grid, sdxGroupRow);
  GridLine := GetElementByName(Group_Grid, sdxGridLine);
  VGridCategory := GetElementByName(Group_VGrid, sdxVGridRowHeader);
  VGridLine[False] := GetElementByName(Group_VGrid, sdxVGridLine);
  VGridLine[True] := GetElementByName(Group_VGrid, sdxVGridBandLine);
end;

procedure TdxSkinInfo.InitializeHeaderElements;
begin
  Header := GetElementByName(Group_Common, sdxHeader);
  HeaderSpecial := GetElementByName(Group_Common, sdxHeaderSpecial);
end;

procedure TdxSkinInfo.InitializeIndicatorImages;
begin
  IndicatorImages := GetElementByName(Group_Grid, sdxIndicatorImages);
end;

procedure TdxSkinInfo.InitializeNavBarElements;
begin
  NavBarBackgroundColor := GetElementByName(Group_NavBar, sdxNavBarBackground);
  NavBarGroupClient := GetElementByName(Group_NavBar, sdxNavBarGroupClient);
  NavBarItem := GetElementByName(Group_NavBar, sdxNavBarItem);
  NavBarGroupHeader := GetElementByName(Group_NavBar, sdxNavBarGroupHeader);
  NavBarGroupButtons[True] := GetElementByName(Group_NavBar, sdxNavBarGroupCloseButton);
  NavBarGroupButtons[False] := GetElementByName(Group_NavBar, sdxNavBarGroupOpenButton);
  NavPaneCollapseButton := GetElementByName(Group_NavPane, sdxNavPaneCollapseButton);
  NavPaneCollapsedGroupClient := GetElementByName(Group_NavPane, sdxNavPaneCollapsedGroupClient);
  NavPaneExpandButton := GetElementByName(Group_NavPane, sdxNavPaneExpandButton);
  NavPaneFormBorder := GetElementByName(Group_NavPane, sdxNavPaneFormBorder);
  NavPaneFormSizeGrip := GetElementByName(Group_NavPane, sdxNavPaneFormSizeGrip);
  NavPaneGroupButton[False] := GetElementByName(Group_NavPane, sdxNavPaneGroupButton);
  NavPaneGroupButton[True] := GetElementByName(Group_NavPane, sdxNavPaneGroupButtonSelected);
  NavPaneGroupCaption := GetElementByName(Group_NavPane, sdxNavPaneGroupCaption);
  NavPaneSplitter := GetElementByName(Group_NavPane, sdxNavPaneSplitter);
  NavPaneScrollButtons[False] := GetElementByName(Group_NavPane, sdxNavPaneScrollUpBtn);
  NavPaneScrollButtons[True] := GetElementByName(Group_NavPane, sdxNavPaneScrollDownBtn);
  NavPaneOverflowPanel := GetElementByName(Group_NavPane, sdxNavPaneOverflowPanel);
  NavPaneOverflowPanelItem := GetElementByName(Group_NavPane, sdxNavPaneOverflowPanelItem);
  NavPaneOverflowPanelExpandedItem := GetElementByName(Group_NavPane, sdxNavPaneOverflowPanelExpandItem);
  NavPaneGroupClient := GetElementByName(Group_NavPane, sdxNavPaneGroupClient);
  NavPaneItem := GetElementByName(Group_NavPane, sdxNavPaneItem);
  NavPaneSelectedItem := GetElementByName(Group_NavPane, sdxNavPaneItemSelected);
  NavPaneCaptionHeight := GetIntPropertyByName(NavPaneGroupCaption, sdxNavPaneCaptionHeight);
  NavPaneCaptionFontSize := GetIntPropertyByName(NavPaneGroupCaption, sdxNavPaneCaptionFontSize);
end;

procedure TdxSkinInfo.InitializeNavigatorElements;
begin
  NavigatorGlyphs := GetElementByName(Group_Editors, sdxNavigatorGlyphs);
  NavigatorGlyphsVert := GetElementByName(Group_Editors, sdxNavigatorGlyphsVert);
end;

procedure TdxSkinInfo.InitializePageControlElements;
begin
  PageControlHeader := GetElementByName(Group_Tabs, sdxPageControlHeaderTop);
  PageControlButtonHorz := GetElementByName(Group_Tabs, sdxPageControlHorz);
  PageControlButtonVert := GetElementByName(Group_Tabs, sdxPageControlVert);
  if FormContent <> nil then
  begin
    if PageControlButtonHorz <> nil then
      PageControlButtonHorz.Color := FormContent.Color;
    if PageControlButtonVert <> nil then
      PageControlButtonVert.Color := FormContent.Color;
  end;
  PageControlPane := GetElementByName(Group_Tabs, sdxPageControlPane);
  FillChar(PageControlIndents, SizeOf(PageControlIndents), 0);
  if Group_Tabs <> nil then
  begin
    PageControlIndents[0] := GetElementIntProperty(Group_Tabs, sdxRowIndentFar);
    PageControlIndents[1] := GetElementIntProperty(Group_Tabs, sdxRowIndentNear);
    PageControlIndents[2] := GetElementIntProperty(Group_Tabs, sdxSelectedHeaderDownGrow);
    PageControlIndents[3] := GetElementIntProperty(Group_Tabs, sdxSelectedHeaderHGrow);
    PageControlIndents[4] := GetElementIntProperty(Group_Tabs, sdxSelectedHeaderUpGrow);
    PageControlIndents[5] := GetElementIntProperty(Group_Tabs, sdxHeaderDownGrow);
  end;
end;

procedure TdxSkinInfo.InitializeProgressBarElements;
begin
  ProgressBarElements[False, False] := GetElementByName(Group_Editors, sdxProgressBorder);
  ProgressBarElements[False, True] := GetElementByName(Group_Editors, sdxProgressBorderVert);
  ProgressBarElements[True, False] := GetElementByName(Group_Editors, sdxProgressChunk);
  ProgressBarElements[True, True] := GetElementByName(Group_Editors, sdxProgressChunkVert);
end;

procedure TdxSkinInfo.InitializeRadioGroupElements;
begin
  RadioGroupButton := GetElementByName(Group_Editors, sdxRadioGroup);
end;

procedure TdxSkinInfo.InitializeRibbonColors;

  function GetElementTextColor(AElement: TdxSkinElement): TColor;
  begin
    if AElement = nil then
      Result := clDefault
    else
      Result := AElement.TextColor;
  end;

begin
  RibbonExtraPaneColor := GetColorByName(Group_Ribbon, sdxRibbonExtraPaneColor);

  RibbonCaptionText[False] := GetElementColorProperty(RibbonFormCaption, sdxTextInactiveColor);
  RibbonCaptionText[True] := GetElementTextColor(RibbonFormCaption);
  RibbonTabText[True] := GetElementColorProperty(RibbonTab, sdxTextColorSelected);
  RibbonTabText[False] := GetElementTextColor(RibbonTab);
  RibbonDocumentNameTextColor[True] := GetElementColorProperty(RibbonFormCaption,
    sdxRibbonDocumentNameTextColor);
  RibbonDocumentNameTextColor[False] := RibbonCaptionText[False];

  RibbonStatusBarText := GetElementColorProperty(RibbonStatusBarButton,

⌨️ 快捷键说明

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