c# 动态加载工具栏按钮代码
int jl = mydrlinks.Length ;
cwfControls.CwfToolbutton mybut1;
string imgfile="";
for (int i = 0; i < jl; i++)
{
mybut1 = new cwfControls.CwfToolbutton();
mybut1.Name = "tbut" + mydrlinks[i]["linkname"].ToString();
mybut1.appFieldName = mydrlinks[i]["linkname"].ToString();
mybut1.appFrame = mydrlinks[i]["frame"].ToString();
mybut1.appTabName = this.appTabName;
mybut1.appWorkTable = this;
mybut1.appTable2 = mydrlinks[i]["tablename2"].ToString();
mybut1.appType = mydrlinks[i]["type"].ToString();
imgfile = mydrlinks[i]["btnimage"].ToString();
if (string.IsNullOrEmpty(imgfile) == false)
{
mybut1.Image = CurrencyWorkFable.cwfResLoad.getResImage(imgfile);
}
if (cwfIosys.dataCtrl.StrToInt(mydrlinks[i]["type"]) == 0)//下级工作导航
{
mybut1.Click += new EventHandler(cwfButSonLink_Click);
}
else if (cwfIosys.dataCtrl.StrToInt(mydrlinks[i]["type"]) == 1)//执行
{
mybut1.Click += new EventHandler(cwfButRunCmd_Click);
if (string.IsNullOrEmpty(imgfile) == true)
{
mybut1.Image = CurrencyWorkFable.cwfResLoad.getResImage("btn_run.gif");
}
}
else if (cwfIosys.dataCtrl.StrToInt(mydrlinks[i]["type"]) == 2)//打印
{
mybut1.Image = cwfResLoad.getResImage("print.png");
mybut1.Click += new EventHandler(cwfsys_runwork.cwfButDyLink_Click);
}
else if (cwfIosys.dataCtrl.StrToInt(mydrlinks[i]["type"]) == 3)//工作链接
{
mybut1.Click += new EventHandler(cwfButLinkWork_Click);
}
if (mydrlinks[i]["formmode"] != null)
{ mybut1.appFormMode = mydrlinks[i]["formmode"].ToString(); }
else
{ mybut1.appFormMode = ""; }
mybut1.Text = mydrlinks[i]["objjc"].ToString();
mybut1.ToolTipText = mydrlinks[i]["objexplain"].ToString();
mytls.Items.Add(mybut1);
if (string.IsNullOrEmpty(mybut1.Text) == true)
{ mybut1.Visible = false; }
}
posted on 2010-06-15 15:36 gds通用软件开发系统 阅读(670) 评论(0) 编辑 收藏 举报