📄 dfsstatusbarreg.pas
字号:
{$I DFS.INC}
unit DFSStatusBarReg;
interface
uses
DsgnIntf, contnrs;
type
TDFSStatusBarEditor = class(TDefaultEditor)
protected
procedure RunPropertyEditor(Prop: TPropertyEditor);
public
procedure ExecuteVerb(Index : Integer); override;
function GetVerb(Index : Integer): string; override;
function GetVerbCount : Integer; override;
procedure Edit; override;
end;
procedure Register;
implementation
uses
Dialogs, Windows, DFSStatusBar, DFSAbout, Classes, SysUtils, TypInfo;
procedure Register;
begin
RegisterComponents('MyButton', [TDFSStatusBar]);
RegisterPropertyEditor(TypeInfo(TDFSVersion), TDFSStatusBar, 'Version',
TDFSVersionProperty);
{ We have to replace the panels editor that's registered for TStatusBar with
our own because otherwise it would edit the TStatusBar.Panels property,
which is of the type TStatusPanels. We don't want that because it doesn't
know about our new stuff in TDFSStatusPanel. }
RegisterComponentEditor(TDFSStatusBar, TDFSStatusBarEditor);
end;
{ TDFSStatusBarEditor }
procedure TDFSStatusBarEditor.Edit;
var
List: TComponentList;
begin
List := TComponentList.Create;
try
List.Add(Component);
GetComponentProperties(TDesignerSelectionList(List), [tkClass], Designer, RunPropertyEditor);
finally
List.Free;
end;
end;
procedure TDFSStatusBarEditor.RunPropertyEditor(Prop: TPropertyEditor);
begin
if UpperCase(Prop.GetName) = 'PANELS' then
Prop.Edit;
end;
procedure TDFSStatusBarEditor.ExecuteVerb(Index: Integer);
begin
if Index <> 0 then Exit; { We only have one verb, so exit if this ain't it }
Edit; { Invoke the Edit function the same as if double click had happened }
end;
function TDFSStatusBarEditor.GetVerb(Index: Integer): string;
begin
Result := '&Panels Editor...'; { Menu item caption for context menu }
end;
function TDFSStatusBarEditor.GetVerbCount: Integer;
begin
Result := 1; // Just add one menu item.
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -