怎么在Delphi的IDE界面上放上自己的按钮。。。基本解决 (200分)

  • 主题发起人 主题发起人 savenight
  • 开始时间 开始时间
你讲的是不是像FOXMAIL那样,安装后在WORD2000上会有他的BUTTON?
delphi的接口资料那里有?
 
nonsense, waste time.
 
what is nonsense?
shut up your mouth if you can not do that!
 
谁看见过Delphi 上可以放一大堆第三方的工具??没有。假如那些公司可以这么做了,说
明有,否则没有。
 
首先用ToolApi的接口,加到菜单上,然后在菜单栏上点右键,选Customize,在Command栏中将该命令托到快捷栏就行了
 
GreenLight: 你用这种方法做成功了?
 
失望呀,大富翁高手如云,到头来尽然没有一个人回答这个问题:(
今天在borland的http://codecentral.borland.com找了一段代码,看看吧:
///////////////////////////////////////////////////////////////////////////
unit ToolBarExpert;

interface

uses
Classes, SysUtils, Windows, Dialogs, ToolsAPI, Menus, comctrls, actnlist;

type
TToolBarWizard = class(TNotifierObject,IOTAWizard)
private
procedure CreateToolBar;
procedure ViewXYZCmdExecute(Sender: TObject);
procedure ViewXYZCmdUpdate(Sender: TObject);
protected
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute;
public
constructor Create;
destructor Destroy; override;
end;

TToolBarClass=class of TToolBar;

procedure Register;

implementation

uses
forms;

procedure Register;
begin
RegisterPackageWizard(TToolBarWizard.Create);
end;

{ TToolBarWizard }

constructor TToolBarWizard.Create;
begin
inherited ;
CreateToolBar;
end;

procedure TToolBarWizard.CreateToolBar;
var
DockToolBar: TToolBarClass;
StdToolBar,XYZToolBar: TToolBar;
ViewStdCmd,ViewXYZCmd: TAction;
begin
StdToolBar:=(BorlandIDEServices as INTAServices).ToolBar['StandardToolBar'];//TToolBar(Application.MainForm.FindComponent('StandardToolBar'));
DockToolBar:=TToolBarClass(StdToolBar.ClassType);

XYZToolBar:=DockToolBar.Create(Application.MainForm);
XYZToolBar.Name:='XYZToolBar';
XYZToolBar.Caption:='XYZ';
XYZToolBar.OnGetSiteInfo:=StdToolBar.OnGetSiteInfo;
XYZToolBar.Constraints.MinHeight:=StdToolBar.Constraints.MinHeight;
XYZToolBar.Constraints.MinWidth:=StdToolBar.Constraints.MinWidth;
XYZToolBar.DockSite:=StdToolBar.DockSite;
XYZToolBar.DragKind:=StdToolBar.DragKind;
XYZToolBar.DragMode:=StdToolBar.DragMode;
XYZToolBar.PopupMenu:=StdToolBar.PopupMenu;
XYZToolBar.OnStartDock:=StdToolBar.OnStartDock;
XYZToolBar.OnEndDock:=StdToolBar.OnEndDock;
XYZToolBar.ShowHint:=StdToolBar.ShowHint;
XYZToolBar.ShowCaptions:=StdToolBar.ShowCaptions;
XYZToolBar.Parent:=StdToolBar.Parent;
XYZToolBar.Images:=StdToolBar.Images;
XYZToolBar.Visible:=True;

ViewStdCmd:=TAction(Application.MainForm.FindComponent('ViewStandardCommand'));
if ViewStdCmd<>nil then
begin
ViewXYZCmd:=TAction.Create(Application.MainForm);
ViewXYZCmd.ActionList:=ViewStdCmd.ActionList;
ViewXYZCmd.Name:='ViewXYZCommand';
ViewXYZCmd.Caption:='X&YZ';
ViewXYZCmd.Category:='View';
ViewXYZCmd.OnExecute:=ViewXYZCmdExecute;
ViewXYZCmd.OnUpdate:=ViewXYZCmdUpdate;
end;
end;

destructor TToolBarWizard.Destroy;
begin

inherited;
end;

procedure TToolBarWizard.Execute;
begin
end;

function TToolBarWizard.GetIDString: string;
begin
Result:='EP.ToolBarWizard';
end;

function TToolBarWizard.GetName: string;
begin
Result:='Tool Bar Wizard';
end;

function TToolBarWizard.GetState: TWizardState;
begin
Result:=[];
end;

procedure TToolBarWizard.ViewXYZCmdExecute(Sender: TObject);
var
XYZToolBar: TToolBar;
begin
XYZToolBar:=(BorlandIDEServices as INTAServices).ToolBar['XYZToolBar'];
if XYZToolBar<>nil then
XYZToolBar.Visible:=not XYZToolBar.Visible;
end;

procedure TToolBarWizard.ViewXYZCmdUpdate(Sender: TObject);
var
XYZToolBar: TToolBar;
begin
XYZToolBar:=(BorlandIDEServices as INTAServices).ToolBar['XYZToolBar'];
if (XYZToolBar<>nil) and (Sender is TAction) then
TAction(Sender).Checked:=XYZToolBar.Visible;
end;

end.

///////////////////////////////////////////////////////////////////////////
 
接受答案了.
 
后退
顶部