to torble(elbrot): E-mail收到,谢谢不过我需要的是通过代码添加ITME的示例(比如如何添加PAGE以及如何在PAGE中添加按钮等功能),你的例子中的ITEM都是通过IDE界面生成的,似乎简单了一些。能否给我一份更详细的资料?
从控件源码中可以了解:procedure TOutlookBarEditor.ExecuteVerb(Index: Integer); var ovDesigner: IFormDesigner; ovZoneControl: TOutlookBar; ovNewZone, ovMoveZone: TOutlookSection; i: integer; begin ovDesigner := Self.Designer; case Index of 0: // add section begin if (Component is TOutlookBar) then ovZoneControl := (Component as TOutlookBar) else ovZoneControl := (TOutlookSection(Component).Parent as TOutlookBar); ovNewZone := TOutlookSection.Create(ovDesigner.Form); ovNewZone.Name := ovDesigner.UniqueName(TOutlookSection.ClassName); ovNewZone.Caption := ovNewZone.Name; ovNewZone.Parent := ovZoneControl; ovZoneControl.ActiveSection := ovNewZone; ovDesigner.SelectComponent(ovNewZone); ovNewZone.ParentAsZC.Invalidate; end; 1: // move section to down begin if (Component is TOutlookSection) then begin ovZoneControl := (TOutlookSection(Component).Parent as TOutlookBar); ovNewZone := TOutlookSection(Component); if ovNewZone.TabIndex < (ovZoneControl.ZACount - 1) then begin ovMoveZone := ovZoneControl.FindNextTab(ovNewZone); i := ovNewZone.TabIndex; ovNewZone.TabIndex := ovMoveZone.tabindex; ovMoveZone.TabIndex := i; ovZoneControl.Invalidate; end; end; end; 2: // move section to down begin if (Component is TOutlookSection) then begin ovZoneControl := (TOutlookSection(Component).Parent as TOutlookBar); ovNewZone := TOutlookSection(Component); if ovNewZone.TabIndex > 0 then begin ovMoveZone := ovZoneControl.FindPrevTab(ovNewZone); i := ovNewZone.TabIndex; ovNewZone.TabIndex := ovMoveZone.tabindex; ovMoveZone.TabIndex := i; ovZoneControl.Invalidate; end; end; end; end; Designer.Modified; end;procedure TOutlookSectionEditor.ExecuteVerb(Index: Integer); var ovDesigner: IFormDesigner; ovSection: TOutlookSection; ovNewItem: TOutlookItem; ovLastItem: TOutlookItem; begin ovDesigner := Self.Designer; case Index of 0: // add new item begin if (Component is TOutlookSection) then ovSection := (Component as TOutlookSection) else ovSection := (TOutlookItem(Component).Parent as TOutlookSection); ovNewItem := TOutlookItem.Create(ovDesigner.Form); ovNewItem.Name := ovDesigner.UniqueName(TOutlookItem.ClassName); ovNewItem.Caption := ovNewItem.Name; ovNewItem.Parent := ovSection; ovLastItem := TOutlookItem(ovSection.Controls[ovSection.ControlCount - 1]); ovNewItem.Top := ovLastItem.Top + ovLastItem.Height + 2; ovNewItem.Height := TOutlookBar(ovSection.Parent).ButtonHeight; ovNewItem.Parent.Invalidate; end; end; Designer.Modified; end;
你只要看标注了 // add section和// add new item这些地方就可以了
to torble(elbrot): 我发现我和你用的TOutLookBar控件不一样,你用的是不是1st的?
这个控件的开头是这样的:TOutlookBar Copyright (c). 2000. Emerson de Almeida Carneiro. Barra de menus verticais estilo MS-OutLook.
那个版本无所谓啊,关键你不是要知道怎样动态建立 Section 和 Item 吗?
to torble(elbrot): 我可以将我用的发给你看吗?
to torble(elbrot): 请查收...
to shockjoy(无聊死了): [email protected] 谢谢to zhiwen_huang(黄志文): TOutlookBar就是类似于OICQ的用户列表(如好友名单、黑名单)一样的界面。
[email protected]万分感谢!
/**************************************/
/* 学无止境 */
/**************************************/
E-mail收到,谢谢不过我需要的是通过代码添加ITME的示例(比如如何添加PAGE以及如何在PAGE中添加按钮等功能),你的例子中的ITEM都是通过IDE界面生成的,似乎简单了一些。能否给我一份更详细的资料?
var
ovDesigner: IFormDesigner;
ovZoneControl: TOutlookBar;
ovNewZone, ovMoveZone: TOutlookSection;
i: integer;
begin
ovDesigner := Self.Designer;
case Index of
0: // add section
begin
if (Component is TOutlookBar) then
ovZoneControl := (Component as TOutlookBar)
else
ovZoneControl := (TOutlookSection(Component).Parent as TOutlookBar);
ovNewZone := TOutlookSection.Create(ovDesigner.Form);
ovNewZone.Name := ovDesigner.UniqueName(TOutlookSection.ClassName);
ovNewZone.Caption := ovNewZone.Name;
ovNewZone.Parent := ovZoneControl;
ovZoneControl.ActiveSection := ovNewZone;
ovDesigner.SelectComponent(ovNewZone);
ovNewZone.ParentAsZC.Invalidate;
end;
1: // move section to down
begin
if (Component is TOutlookSection) then
begin
ovZoneControl := (TOutlookSection(Component).Parent as TOutlookBar);
ovNewZone := TOutlookSection(Component);
if ovNewZone.TabIndex < (ovZoneControl.ZACount - 1) then begin
ovMoveZone := ovZoneControl.FindNextTab(ovNewZone);
i := ovNewZone.TabIndex;
ovNewZone.TabIndex := ovMoveZone.tabindex;
ovMoveZone.TabIndex := i;
ovZoneControl.Invalidate;
end;
end;
end;
2: // move section to down
begin
if (Component is TOutlookSection) then
begin
ovZoneControl := (TOutlookSection(Component).Parent as TOutlookBar);
ovNewZone := TOutlookSection(Component);
if ovNewZone.TabIndex > 0 then begin
ovMoveZone := ovZoneControl.FindPrevTab(ovNewZone);
i := ovNewZone.TabIndex;
ovNewZone.TabIndex := ovMoveZone.tabindex;
ovMoveZone.TabIndex := i;
ovZoneControl.Invalidate;
end;
end;
end;
end;
Designer.Modified;
end;procedure TOutlookSectionEditor.ExecuteVerb(Index: Integer);
var
ovDesigner: IFormDesigner;
ovSection: TOutlookSection;
ovNewItem: TOutlookItem;
ovLastItem: TOutlookItem;
begin
ovDesigner := Self.Designer;
case Index of
0: // add new item
begin
if (Component is TOutlookSection) then
ovSection := (Component as TOutlookSection)
else
ovSection := (TOutlookItem(Component).Parent as TOutlookSection);
ovNewItem := TOutlookItem.Create(ovDesigner.Form);
ovNewItem.Name := ovDesigner.UniqueName(TOutlookItem.ClassName);
ovNewItem.Caption := ovNewItem.Name;
ovNewItem.Parent := ovSection;
ovLastItem := TOutlookItem(ovSection.Controls[ovSection.ControlCount - 1]);
ovNewItem.Top := ovLastItem.Top + ovLastItem.Height + 2;
ovNewItem.Height := TOutlookBar(ovSection.Parent).ButtonHeight;
ovNewItem.Parent.Invalidate;
end;
end;
Designer.Modified;
end;
我发现我和你用的TOutLookBar控件不一样,你用的是不是1st的?
Copyright (c). 2000. Emerson de Almeida Carneiro.
Barra de menus verticais estilo MS-OutLook.
我可以将我用的发给你看吗?
请查收...
[email protected]
谢谢to zhiwen_huang(黄志文):
TOutlookBar就是类似于OICQ的用户列表(如好友名单、黑名单)一样的界面。
Section 和 Item ,如果想动态的建立 就看上面的例子。 BYE~
我是想问哪有这样的控件呀,我现在正想要用呢
/**************************************/
/* 学无止境 */
/**************************************/
我用的:
http://www.justep.com/downloads/freeware/outlookbar.zip或者是torble(elbrot)发给我的,你要的话留下EMAILto hanlen():
我用的版本中没有Demo。