private void Button_Click(object sender, System.EventArgs e)
{
FlowPanelMessage.Controls.Clear();//从集合中移除所有控件
try
{
Dictionary<string, object> param = new Dictionary<string, object>();
param.Add("hosp_id", "123");//传参
Dictionary<string, object> rdo = HttpUtil.HttpPost("请求的URL路径", param);
ArrayList data = rdo["vds"] as ArrayList;
if (data.Count == 0)
{
DwFunction.ShowMsg("未找到信息");
return;
}
for (int i = 0; i < data.Count; i++)
{
Dictionary<string, object> info = (Dictionary<string, object>)data[i];
string labMsg = Convert.ToString(info["msg_content"]);
InMessageControl control = new InMessageControl(labMsg);//添加的子控件中传数据
FlowPanelMessage.Controls.Add(control);//添加到父控件中
}
}
catch (Exception err)
{
throw new Exception("获取信息-信息提醒:" + err.Message);
}
}
在加载事件中自动实现按钮点击事件
添加Button.PerformClick();