二开案例.工具栏.工具栏应用

【应用场景】通过工具栏菜单按钮,挂载操作、表单服务或者执行插件事件。
【案例演示】物料列表,对左侧分组树上的工具栏进行插件编程控制。

【实现步骤】
<1>编写列表插件,代码如下。
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Core.Metadata.ControlElement;
using Kingdee.BOS.Util;
using System.ComponentModel;
using System.Linq;
namespace Jac.XkDemo.BOS.Business.PlugIn
{
/// <summary>
/// 【列表插件】工具栏应用
/// </summary>
[Description("【列表插件】工具栏应用"), HotUpdate]
public class ToolbarListPlugIn : AbstractListPlugIn
{
private bool visible = true;
private bool enable = true;
/// <summary>
/// 工具栏点击事件
/// </summary>
/// <param name="e"></param>
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
#region 设置工具栏可见性
if (e.BarItemKey == "tbToolbarShowOrHide")
{
visible = !visible;
this.View.GetControl("FGroupToolbar").Visible = visible;
this.View.ShowMessage("工具栏已" + (visible ? "显示" : "隐藏"));
return;
}
#endregion
#region 设置工具栏可用性
if (e.BarItemKey == "tbToolbarEnableOrDisable")
{
enable = !enable;
this.View.GetControl("FGroupToolbar").Enabled = enable;
this.View.ShowMessage("工具栏已" + (enable ? "启用" : "禁用"));
return;
}
#endregion
#region 设置工具栏菜单可见性
if (e.BarItemKey == "tbBarItemShowOrHide")
{
visible = !visible;
this.View.GetBarItem("FGroupToolbar", "tbAddNewGroup").Visible = visible;
this.View.GetBarItem("FGroupToolbar", "tbModify").Visible = visible;
this.View.GetBarItem("FGroupToolbar", "tbDelete").Visible = visible;
this.View.ShowMessage("工具栏菜单已" + (visible ? "显示" : "隐藏"));
二开案例.工具栏.工具栏应用
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。



