📄 bsreg.pas
字号:
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
sTABSHEET_DEFAULT_NAME = 'bsSkinTabSheet';
sNEW_PAGE = 'New page';
sDEL_PAGE = 'Delete page';
procedure Register;
begin
RegisterComponents('BusinessSkinForm VCL', [TbsBusinessSkinForm,
TbsSkinData, TbsCompressedStoredSkin, TbsStoredSkin, TbsSkinMainMenuBar,
TbsSkinPopupMenu, TbsSkinMainMenu, TbsTrayIcon,
TbsSkinPanel, TbsSkinGroupBox,
TbsSkinRadioGroup, TbsSkinCheckGroup,
TbsSkinSpeedButton, TbsSkinMenuSpeedButton,
TbsSkinButton, TbsSkinCheckRadioBox,
TbsSkinGauge, TbsSkinTrackBar, TbsSkinLabel,
TbsSkinHint, TbsSkinDrawGrid, TbsSkinStringGrid,
TbsSkinPageControl, TbsSkinTabControl,
TbsSkinListBox, TbsSkinComboBox, TbsSkinEdit, TbsSkinMaskEdit,
TbsSkinPasswordEdit,
TbsSkinMemo, TbsSkinMemo2,
TbsSkinScrollBar, TbsSkinSpinEdit, TbsSkinCheckListBox,
TbsSkinStdLabel, TbsSkinUpDown,
TbsSkinControlBar, TbsSkinSplitter, TbsSkinMenuButton,
TbsSkinScrollBox, TbsSkinColorComboBox, TbsSkinFontComboBox,
TbsSkinTreeView, TbsSkinListView, TbsSkinStatusPanel,
TbsSkinRichEdit, TbsSkinDateEdit, TbsSkinCalculator, TbsSkinCalcEdit,
TbsSkinZip, TbsSkinUnZip, TbsSkinTextLabel,
TbsSkinFileListBox, TbsSkinDirectoryListBox, TbsSkinDriveComboBox,
TbsSkinFilterComboBox, TbsSkinFileListView, TbsSkinDirTreeView,
TbsSkinShellDriveComboBox,
TbsSkinDirectoryEdit, TbsSkinFileEdit, TbsSkinSaveFileEdit,
TbsSkinExPanel, TbsSkinTrackEdit, TbsSkinHeaderControl, TbsSkinLinkLabel, TbsSkinLinkImage,
TbsSkinButtonLabel, TbsSkinSlider, TbsSkinTimeEdit,
TbsSkinBevel, TbsSkinButtonsBar, TbsSkinNoteBook, TbsSkinMonthCalendar,
TbsSkinXFormButton, TbsSkinColorGrid]);
RegisterComponents('BusinessSkinForm DB VCL',
[TbsSkinDBGrid, TbsSkinDBText,
TbsSkinDBEdit, TbsSkinDBMemo, TbsSkinDBMemo2,
TbsSkinDBCheckRadioBox, TbsSkinDBListBox, TbsSkinDBComboBox,
TbsSkinDBNavigator, TbsSkinDBImage, TbsSkinDBRadioGroup,
TbsSkinDBSpinEdit, TbsSkinDBRichEdit,
TbsSkinDBLookUpListBox, TbsSkinDBLookUpComboBox,
TbsSkinDBCalcEdit, TbsSkinDBDateEdit, TbsSkinDBTimeEdit]);
RegisterComponents('BusinessSkinForm VCL Dialogs',
[TbsSkinMessage,
TbsSkinSelectDirectoryDialog,
TbsSkinOpenDialog, TbsSkinSaveDialog,
TbsSkinOpenPictureDialog, TbsSkinSavePictureDialog,
TbsSkinInputDialog, TbsSkinPasswordDialog, TbsSkinTextDialog,
TbsSkinFontDialog, TbsSkinProgressDialog, TbsSkinConfirmDialog,
TbsSkinColorDialog]);
RegisterClass(TbsSkinTabSheet);
RegisterComponentEditor(TbsSkinPageControl, TbsSkinPageControlEditor);
RegisterComponentEditor(TbsSkinTabSheet, TbsSkinPageControlEditor);
RegisterPropertyEditor(TypeInfo(string), TbsColumn, 'FieldName', TbsColumnDataFieldProperty);
RegisterPropertyEditor(TypeInfo(string), TbsStoredSkin, 'FileName', TbsFilenameProperty);
RegisterPropertyEditor(TypeInfo(string), TbsCompressedStoredSkin, 'FileName', 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), 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), TbsSkinComboBox, 'SkinDataName', TbsComboBoxSkinDataNameProperty);
RegisterPropertyEditor(TypeInfo(string), TbsSkinListBox, 'SkinDataName', TbsListBoxSkinDataNameProperty);
RegisterPropertyEditor(TypeInfo(string), TbsSkinCheckListBox, 'SkinDataName', TbsCheckListBoxSkinDataNameProperty);
RegisterPropertyEditor(TypeInfo(string), TbsSkinSplitter, 'SkinDataName', TbsSplitterSkinDataNameProperty);
RegisterPropertyEditor(TypeInfo(TStrings), TbsSkinNoteBook, 'Pages', TbsSetPagesProperty);
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 // New Page
NewPage := TbsSkinTabSheet.Create(Designer.GetRoot);
with NewPage do
begin
Parent := PControl;
PageControl := PControl;
Caption := sTABSHEET_DEFAULT_NAME + IntToStr(PControl.PageCount);
Name := Caption;
end;
end;
1: begin // Delete Page
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 := 4;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -