基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Lskj.Control;
|
||||
using Lskj.Business.Impl;
|
||||
using DevExpress.XtraEditors;
|
||||
using Lskj.Model;
|
||||
using Lskj.Core;
|
||||
using Lskj.Control.Model;
|
||||
|
||||
namespace Lskj.MesPopupButton
|
||||
{
|
||||
public partial class FrmMain : BaseForm
|
||||
{
|
||||
int width = 210, height = 55, left = 30, space = 10, totalHeight = 0;
|
||||
public DynamicPopupButtonModel Model;
|
||||
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void InitButtons()
|
||||
{
|
||||
int top = 22;
|
||||
//DataTable table = BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode);
|
||||
DataTable table = BaseModuleImpl.GetBaseGridRightMenus("yyyyyhhh");
|
||||
for (int i = 1; i <= table.Rows.Count; i++)
|
||||
{
|
||||
DataRow item = table.Rows[i - 1];
|
||||
|
||||
SimpleButton simpleButton1 = new SimpleButton();
|
||||
simpleButton1.Name = item["id"] + "";
|
||||
simpleButton1.Size = new System.Drawing.Size(width, height);
|
||||
simpleButton1.TabIndex = 0;
|
||||
simpleButton1.Tag = item;
|
||||
simpleButton1.Text = item["menuname"] + "";
|
||||
simpleButton1.Click += new EventHandler(OnButton_Click);
|
||||
|
||||
//if (i == 1)
|
||||
//{
|
||||
simpleButton1.Location = new System.Drawing.Point(left, top);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// simpleButton1.Location = new System.Drawing.Point(29, 22);
|
||||
//}
|
||||
if (i == table.Rows.Count)
|
||||
{
|
||||
|
||||
}
|
||||
top = top + simpleButton1.Height + space;
|
||||
this.Controls.Add(simpleButton1);
|
||||
}
|
||||
totalHeight = top + height + 22;
|
||||
this.Height = totalHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:打开功能</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-12-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataRow rowItem = (sender as SimpleButton).Tag as DataRow;
|
||||
|
||||
CommonMenu menu = new CommonMenu(this.Model, new MyControl());
|
||||
//menu.ApplyBefore += new CommonToolApplyEventHandler(OnMenuApplyBefore);
|
||||
menu.Apply(rowItem);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:窗口加载</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2019-12-23 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void OnMainLoad(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ERPInfo.Instance.UserId = "1";
|
||||
ERPInfo.Instance.UserName = "管理员";
|
||||
if (DBConfig.Instance.CreateConnection())
|
||||
{
|
||||
//Model = new DynamicPopupButtonModel()
|
||||
this.InitButtons();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
||||
MessageUtil.Show(Message,ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user