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

📄 bsreg.pas

📁 BusinessSkinForm的控件包与实例
💻 PAS
📖 第 1 页 / 共 3 页
字号:

type

  TbsColumnDataFieldProperty = class(TbsDBStringProperty)
    procedure GetValueList(List: TStrings); override;
  end;

procedure TbsColumnDataFieldProperty.GetValueList(List: TStrings);
var
  Grid: TbsSkinCustomDBGrid;
  DataSource: TDataSource;
begin
  Grid := (GetComponent(0) as TbsColumn).Grid;
  if (Grid = nil) then Exit;
  DataSource := Grid.DataSource;
  if (DataSource <> nil) and (DataSource.DataSet <> nil) then
    DataSource.DataSet.GetFieldNames(List);
end;

type
  TbsSkinDBLookUpListBoxFieldProperty = class(TbsDBStringProperty)
    procedure GetValueList(List: TStrings); override;
  end;

procedure TbsSkinDBLookUpListBoxFieldProperty.GetValueList(List: TStrings);
var
  DataSource: TDataSource;
  LookUpControl: TbsDBLookUpControl;
begin
  DataSource := (GetComponent(0) as TbsSkinDBLookUpListBox).ListSource;
  if (DataSource <> nil) and (DataSource.DataSet <> nil) then
    DataSource.DataSet.GetFieldNames(List);
end;

type
  TbsSkinDBLookUpComboBoxFieldProperty = class(TbsDBStringProperty)
    procedure GetValueList(List: TStrings); override;
  end;

procedure TbsSkinDBLookUpComboBoxFieldProperty.GetValueList(List: TStrings);
var
  DataSource: TDataSource;
  LookUpControl: TbsDBLookUpControl;
begin
  DataSource := (GetComponent(0) as TbsSkinDBLookUpComboBox).ListSource;
  if (DataSource <> nil) and (DataSource.DataSet <> nil) then
    DataSource.DataSet.GetFieldNames(List);
end;

type
  TbsSetPagesProperty = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
    procedure SetValue(const Value: string); override;
   end;

procedure TbsSetPagesProperty.Edit;
var
  NB: TbsSkinNoteBook;
begin
  try
    NB := TbsSkinNoteBook(GetComponent(0));
    NBPagesEditor.Execute(NB);
  finally
  end;
end;

function TbsSetPagesProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog];
end;

function TbsSetPagesProperty.GetValue: string;
begin
  Result := '(Pages)';
end;

procedure TbsSetPagesProperty.SetValue(const Value: string);
begin
  if Value = '' then SetOrdValue(0);
end;

{ Registration }

resourcestring
  sNEW_PAGE = 'New page';
  sDEL_PAGE = 'Delete page';

  sNEW_STATUSPANEL = 'New panel';
  sNEW_STATUSGAUGE = 'New gauge';
  sNEW_STATUSEDIT = 'New edit';
  sNEW_STATUSBUTTONEDIT = 'New edit with button';
  sNEW_STATUSCOMBOBOX = 'New combobox';
  sNEW_STATUSSPINEDIT = 'New spinedit';

  sNEW_TOOLBUTTON = 'New button';
  sNEW_TOOLMENUBUTTON = 'New button with dropdown menu';
  sNEW_TOOLMENUTRACKBUTTON = 'New button with chevron and dropdown menu';

  sNEW_TOOLSEPARATOR = 'New separator';
  sNEW_TOOLCOMBOBOX = 'New combobox';
  sNEW_TOOLEDIT = 'New edit';
  sNEW_TOOLBUTTONEDIT = 'New edit with button';
  sNEW_TOOLSPINEDIT = 'New spinedit';
  sNEW_TOOLCALCEDIT = 'New calc edit';
  sNEW_TOOLFONTCOMBOBOX = 'New font combobox';
  sNEW_TOOLFONTSIZECOMBOBOX = 'New font size combobox';

  sNEW_TOOLMENUCOLORBUTTON = 'New color button';
  sNEW_TOOLMENUCOLORTRACKBUTTON = 'New color button with chevron';

procedure RewritePublishedProperty(ComponentClass: TClass; const PropertyName: string);
var
   LPropInfo: PPropInfo;
begin
  LPropInfo := GetPropInfo(ComponentClass, PropertyName);
  if LPropInfo <> nil
  then
    RegisterPropertyEditor(LPropInfo^.PropType^, ComponentClass, PropertyName, TbsPNGPropertyEditor);
end;

procedure Register;
begin
  RegisterComponents('BusinessSkinForm VCL',  [TbsBusinessSkinForm, TbsSkinFrame,
    TbsSkinData, TbsResourceStrData, TbsCompressedSkinList, 
    TbsCompressedStoredSkin, TbsSkinMainMenuBar,
    TbsSkinMDITabsBar, TbsSkinHint, TbsTrayIcon, TbsSkinZip, TbsSkinUnZip,

    TbsSkinPopupMenu, TbsSkinMainMenu, TbsSkinImagesMenu, 

    TbsSkinScrollBar,

    TbsSkinSpeedButton, TbsSkinMenuSpeedButton, TbsSkinColorButton,
    TbsSkinButton, TbsSkinMenuButton, TbsSkinXFormButton, TbsSkinUpDown,
    TbsSkinCheckRadioBox,

    TbsSkinGauge, TbsSkinAnimateGauge,
    TbsSkinTrackBar, TbsSkinSlider, TbsSkinSplitter, TbsSkinSplitterEx,

    TbsSkinLabel, TbsSkinStdlabel, TbsSkinTextLabel,
    TbsSkinButtonLabel, TbsSkinLinkLabel, TbsSkinLinkImage,
    TbsSkinBevel,

    TbsSkinEdit, TbsSkinMaskEdit,
    TbsSkinPasswordEdit, TbsSkinTrackEdit, TbsSkinTimeEdit,
    TbsSkinSpinEdit, TbsSkinNumericEdit, TbsSkinDateEdit,  TbsSkinMonthCalendar,
    TbsSkinCalculator, TbsSkinCalcEdit, TbsSkinURLEdit, 
    TbsSkinMemo, TbsSkinMemo2, TbsSkinRichEdit, TbsSkinCurrencyEdit,
    TbsSkinCalcCurrencyEdit,

    TbsSkinListBox, TbsSkinComboBox, TbsSkinMRUComboBox, TbsSkinComboBoxEx,
    TbsSkinCheckListBox,  TbsSkinCheckComboBox,
    TbsSkinColorComboBox, TbsSkinColorListBox,
    TbsSkinFontComboBox, TbsSkinFontListBox,
    TbsSkinFontSizeComboBox,

    TbsSkinPanel, TbsSkinGroupBox, TbsSkinExPanel, TbsSkinScrollPanel,
    TbsSkinPaintPanel, 
    TbsSkinRadioGroup, TbsSkinCheckGroup,TbsSkinStatusBar, TbsSkinStatusPanel,
    TbsSkinControlBar, TbsSkinCoolBar,
    TbsSkinToolBar, TbsSkinHeaderControl, TbsSkinButtonsBar,
    TbsSkinNoteBook,  TbsSkinScrollBox, TbsSkinPageControl, TbsSkinTabControl,
    TbsSkinDrawGrid, TbsSkinStringGrid,
    TbsSkinTreeView, TbsSkinListView,

    TbsSkinFileListBox, TbsSkinDirectoryListBox, TbsSkinDriveComboBox,
    TbsSkinFilterComboBox, TbsSkinFileListView, TbsSkinDirTreeView,
    TbsSkinShellDriveComboBox,  TbsSkinShellComboBox,
    TbsSkinDirectoryEdit, TbsSkinFileEdit, TbsSkinSaveFileEdit,

    TbsSkinColorGrid, TbsSkinCategoryButtons, TbsSkinButtonGroup,
    TbsPngImageList, TbsPngImageView]);

  RegisterComponents('BusinessSkinForm DB VCL',
    [TbsSkinDBGrid, TbsSkinDBText,
     TbsSkinDBEdit, TbsSkinDBMemo, TbsSkinDBMemo2,
     TbsSkinDBCheckRadioBox, TbsSkinDBListBox, TbsSkinDBComboBox,
     TbsSkinDBNavigator, TbsSkinDBImage, TbsSkinDBRadioGroup,
     TbsSkinDBSpinEdit, TbsSkinDBRichEdit,
     TbsSkinDBLookUpListBox, TbsSkinDBLookUpComboBox,
     TbsSkinDBCalcEdit, TbsSkinDBDateEdit, TbsSkinDBTimeEdit,
     TbsSkinDBPasswordEdit, TbsSkinDBNumericEdit,
     TbsSkinDBCurrencyEdit, TbsSkinDBCalcCurrencyEdit,
     TbsSkinDbGauge, TbsSkinDbSlider, TbsSkinDBMRUComboBox,
     TbsSkinDBCtrlGrid, TbsSkinDBURLEdit]);

  RegisterComponents('BusinessSkinForm VCL Dialogs',
    [TbsSkinMessage, TbsOpenSkinDialog, TbsSelectSkinDialog,
     TbsSelectSkinsFromFoldersDialog,  
     TbsSkinSelectDirectoryDialog,
     TbsSkinOpenDialog, TbsSkinSaveDialog,
     TbsSkinOpenPictureDialog, TbsSkinSavePictureDialog,
     TbsSkinInputDialog, TbsSkinPasswordDialog, TbsSkinTextDialog,
     TbsSkinFontDialog, TbsSkinProgressDialog, TbsSkinConfirmDialog,
     TbsSkinColorDialog, TbsSkinSelectValueDialog,
     TbsSkinPrintDialog, TbsSkinPrinterSetupDialog, TbsSkinSmallPrintDialog,
     TbsSkinPageSetupDialog,
     TbsSkinFindDialog, TbsSkinReplaceDialog,
     TbsSkinOpenPreviewDialog, TbsSkinSavePreviewDialog,
     TbsSkinOpenSoundDialog, TbsSkinSaveSoundDialog]);

  RegisterComponents('BusinessSkinForm VCL Graphics',
    [TbsSkinGradientStyleButton, TbsSkinBrushStyleButton,
     TbsSkinPenStyleButton, TbsSkinPenWidthButton,
     TbsSkinShadowStyleButton,
     TbsSkinBrushColorButton,
     TbsSkinTextColorButton]);


  RegisterClass(TbsSkinTabSheet);

  RegisterComponentEditor(TbsSkinPageControl, TbsSkinPageControlEditor);
  RegisterComponentEditor(TbsSkinStatusBar, TbsSkinStatusBarEditor);
  RegisterComponentEditor(TbsSkinToolBar, TbsSkinToolBarEditor);
  RegisterComponentEditor(TbsSkinTabSheet, TbsSkinPageControlEditor);

  RegisterPropertyEditor(TypeInfo(string), TbsColumn, 'FieldName', TbsColumnDataFieldProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinListItem, 'FileName', TbsFilenameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinListItem, 'CompressedFileName', TbsFilenameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsCompressedStoredSkin, 'FileName', TbsFilenameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsCompressedStoredSkin, 'CompressedFileName', TbsFilenameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpListBox, 'KeyField', TbsSkinDBLookUpListBoxFieldProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpListBox, 'ListField', TbsSkinDBLookUpListBoxFieldProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpComboBox, 'KeyField', TbsSkinDBLookUpComboBoxFieldProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinDBLookUpComboBox, 'ListField', TbsSkinDBLookUpComboBoxFieldProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinButton, 'SkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinCategoryButtons, 'ButtonsSkinDataName', TbsCategoryButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinCategoryButtons, 'CategorySkinDataName', TbsCategorySkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinButtonGroup, 'ButtonsSkinDataName', TbsCategoryButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinEdit, 'SkinDataName', TbsEditSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinTrackEdit, 'SkinDataName', TbsTrackEditSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSpinEdit, 'SkinDataName', TbsSpinEditSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinDBNavigator, 'BtnSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinButtonsBar, 'SectionButtonSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinHeaderControl, 'SkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinListView, 'HeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinFileEdit, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSaveFileEdit, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinOpenDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinOpenPictureDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSaveDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSavePictureDialog, 'LVHeaderSkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinGauge, 'SkinDataName', TbsGaugeSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinMenuButton, 'SkinDataName', TbsMenuButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSpeedButton, 'SkinDataName', TbsButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinMenuSpeedButton, 'SkinDataName', TbsMenuButtonSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinPanel, 'SkinDataName', TbsPanelSkinDataNameProperty);

  RegisterPropertyEditor(TypeInfo(string), TbsSkinMonthCalendar, 'SkinDataName', TbsCalendarSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinDateEdit, 'CalendarSkinDataName', TbsCalendarSkinDataNameProperty);

  RegisterPropertyEditor(TypeInfo(string), TbsSkinToolBar, 'SkinDataName', TbsToolBarSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinComboBox, 'SkinDataName', TbsComboBoxSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinListBox, 'SkinDataName', TbsListBoxSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinCheckListBox, 'SkinDataName', TbsCheckListBoxSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSplitter, 'SkinDataName', TbsSplitterSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(string), TbsSkinSplitterEx, 'SkinDataName', TbsSplitterSkinDataNameProperty);
  RegisterPropertyEditor(TypeInfo(TStrings),  TbsSkinNoteBook, 'Pages', TbsSetPagesProperty);

  //
  RegisterPropertyEditor(TypeInfo(TRoot), TbsSkinDirTreeView, 'Root', TbsRootProperty);
  RegisterPropertyEditor(TypeInfo(TRoot), TbsSkinFileListView, 'Root', TbsRootProperty);
  RegisterPropertyEditor(TypeInfo(TRoot), TbsSkinShellComboBox, 'Root', TbsRootProperty);
  RegisterComponentEditor(TbsSkinDirTreeView, TbsRootEditor);
  RegisterComponentEditor(TbsSkinFileListView, TbsRootEditor);
  RegisterComponentEditor(TbsSkinShellComboBox, TbsRootEditor);
  //
  RewritePublishedProperty(TbsPngImageItem, 'PngImage');
end;

function TbsSkinPageControlEditor.GetVerb(Index: Integer): string;
begin
  case Index of
    0:  result := sNEW_PAGE;
    1:  result := sDEL_PAGE;
  end;
end;

procedure TbsSkinPageControlEditor.ExecuteVerb(Index: Integer);
var
  NewPage: TbsSkinCustomTabSheet;
  PControl : TbsSkinPageControl;
begin
  if Component is TbsSkinPageControl then
    PControl := TbsSkinPageControl(Component)
  else PControl := TbsSkinPageControl(TbsSkinTabSheet(Component).PageControl);

  case Index of
    0:  begin
          NewPage := TbsSkinTabSheet.Create(Designer.GetRoot);
          with NewPage do
          begin
            Parent := PControl;
            PageControl := PControl;
            Name := Designer.UniqueName(ClassName);
            Caption := Name;
          end;
        end;
    1:  begin  
          with PControl do
          begin
            NewPage := TbsSkinCustomTabSheet(ActivePage);
            NewPage.PageControl := nil;
            NewPage.Free;
          end;
        end;
  end;
  if Designer <> nil then Designer.Modified;
end;

function TbsSkinPageControlEditor.GetVerbCount: Integer;
begin
  Result := 2;
end;

procedure TbsSkinStatusBarEditor.ExecuteVerb(Index: Integer);
var
  NewPanel: TbsSkinStatusPanel;
  NewGauge: TbsSkinGauge;
  NewEdit: TbsSkinEdit;
  NewSpinEdit: TbsSkinSpinEdit;
  NewComboBox: TbsSkinComboBox;
  PControl : TbsSkinStatusBar;
begin
  if Component is TbsSkinStatusBar
  then
    PControl := TbsSkinStatusBar(Component)
  else
    Exit;
  case Index of
    0:  begin
          NewPanel := TbsSkinStatusPanel.Create(Designer.GetRoot);
          with NewPanel do
          begin
            Left := PControl.Width;
            Parent := PControl;
            Align := alLeft;
            Name := Designer.UniqueName(ClassName);
            SkinData := PControl.SkinData;
            Designer.SelectComponent(NewPanel);
          end;
        end;
    1:  begin
          NewGauge := TbsSkinGauge.Create(Designer.GetRoot);
          with NewGauge do
          begin
            Left := PControl.Width;
            SkinDataName := 'statusgauge';
            Parent := PControl;
            Align := alLeft;
            Name := Designer.UniqueName(ClassName);
            SkinData := PControl.SkinData;
            Designer.SelectComponent(NewGauge);
          end;
        end;
    2:
       begin
         NewEdit := TbsSkinEdit.Create(Designer.GetRoot);
          with NewEdit do
          begin
            Left := PControl.Width;
            SkinDataName := 'statusedit';
            Parent := PControl;
            Align := alLeft;
            Name := Designer.UniqueName(ClassName);

⌨️ 快捷键说明

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