SVN-Revision: r891
This commit is contained in:
wyf
2025-07-24 06:01:16 +00:00
parent 5ebde4c564
commit cf35995f85
4 changed files with 82 additions and 68 deletions
+3 -4
View File
@@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainPanelControlEx));
this.tslCompany = new System.Windows.Forms.ToolStripLabel();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
@@ -113,7 +112,7 @@
this.btnClose = new System.Windows.Forms.Button();
this.pl_top_left = new System.Windows.Forms.Panel();
this.lblSubTitle = new System.Windows.Forms.Label();
this.mark_timer = new System.Windows.Forms.Timer(this.components);
this.mark_timer = new System.Windows.Forms.Timer();
this.autoGridLookUpEdit1View = new DevExpress.XtraGrid.Views.Grid.GridView();
this.awaitScreenControl = new Lskj.Main.Control.AwaitScreenControl();
this.toolStrip1.SuspendLayout();
@@ -369,7 +368,7 @@
//
// allMenuPanel
//
this.allMenuPanel.BackColor = System.Drawing.Color.Transparent;
this.allMenuPanel.BackColor = System.Drawing.Color.White;
this.allMenuPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.allMenuPanel.Location = new System.Drawing.Point(0, 26);
this.allMenuPanel.Margin = new System.Windows.Forms.Padding(0);
@@ -453,7 +452,7 @@
//
// collectMenuPanel
//
this.collectMenuPanel.BackColor = System.Drawing.Color.Transparent;
this.collectMenuPanel.BackColor = System.Drawing.Color.White;
this.collectMenuPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.collectMenuPanel.Location = new System.Drawing.Point(0, 26);
this.collectMenuPanel.Margin = new System.Windows.Forms.Padding(0);
@@ -123,7 +123,7 @@ namespace Lskj.Main.Control
/// <summary>
/// 缓存菜单控件
/// </summary>
private Dictionary<string, List<Menu_ItemNew>> _menus = new Dictionary<string, List<Menu_ItemNew>>();
private Dictionary<string, List<UserControl>> _menus = new Dictionary<string, List<UserControl>>();
/// <summary>
/// 缓存分组控件
/// </summary>
@@ -139,7 +139,7 @@ namespace Lskj.Main.Control
/// <summary>
/// 缓存菜单
/// </summary>
private List<Menu_ItemNew> _menuItemList = new List<Menu_ItemNew>();
private List<UserControl> _menuItemList = new List<UserControl>();
/// <summary>
/// 第一个menuItem
/// </summary>
@@ -651,6 +651,11 @@ namespace Lskj.Main.Control
/// </summary>
private void SetMenus()
{
var groupMenus = this._allMenus.AsEnumerable().Where(n => n.Table.Columns.Contains("groupcaption") && !string.IsNullOrEmpty(n["groupcaption"] + ""));
if (groupMenus.Count() == 0)
{
this._allMenus.Columns.Remove("groupcaption");
}
FontFamily fontFamily = FontUtil.Fonts.Families.Where(n => n.Name.Equals("MiSans")).FirstOrDefault();
if (fontFamily != null)
{
@@ -679,6 +684,7 @@ namespace Lskj.Main.Control
{
int buttonTop = Convert.ToInt32(0.05 * DpiY); // 按钮上边距
int menuLeft = Convert.ToInt32(0.05 * DpiY), menuTop = Convert.ToInt32(0.05 * DpiY); // 模块距离左边距,模块距离顶部边距
int menuWidthOld = Convert.ToInt32(1.14 * DpiX), menuHeightOld = Convert.ToInt32(1.32 * DpiY); // 旧模块宽度,模块高度
int menuWidth = Convert.ToInt32(2.5 * DpiX), menuHeight = Convert.ToInt32(0.73 * DpiY); // 模块宽度,模块高度
int buttonWidth = Convert.ToInt32(0.44 * DpiX), buttonHeight = Convert.ToInt32(0.44 * DpiY); // 模块宽度,模块高度
//int centerWidth = pl_center_main.Width - pl_center_main_right.Width; // 内容区域宽度-右侧快捷栏宽度
@@ -699,6 +705,10 @@ namespace Lskj.Main.Control
panelSplit.Visible = false;
botTipsPanel.Visible = false;
}
if (groupMenus.Count() == 0)
{
allPanel.Visible = false;
}
if (this._allMenus.Columns.Contains("groupcaption") && !isFlowLayout && isShowGrallyInTop)
{
GroupControl baseGroupControl = new GroupControl();
@@ -909,7 +919,7 @@ namespace Lskj.Main.Control
// 缓存控件
if (!_menus.Keys.Contains(menuStruct))
{
_menus.Add(menuStruct, new List<Menu_ItemNew>());
_menus.Add(menuStruct, new List<UserControl>());
}
#region
if (this._allMenus.Columns.Contains("menuposition") && (SystemInfo.Instance.IsOpenWork || SystemInfo.Instance.ShowGallerysFromMenu) && !SystemInfo.Instance.HideGallerys)
@@ -1153,7 +1163,7 @@ namespace Lskj.Main.Control
}
}
groupControl.MenuPanel.Controls.Add(menu);
List<Menu_ItemNew> controls = new List<Menu_ItemNew>();
List<UserControl> controls = new List<UserControl>();
if (_menus.TryGetValue(menuStruct, out controls))
{
controls.Add(menu);
@@ -1210,17 +1220,15 @@ namespace Lskj.Main.Control
string defaultImg = PubUtil.MainMenuDefaultImage + item["MouseOutImg"] + "";
string hoverImg = PubUtil.MainMenuDefaultImage + item["MouseOverImg1"] + "";
string[] menuTag = new string[] { item["DllFileName"] + "", item["PurviewId"] + "", item["MenuId"] + "", item["UrlParams"] + "", item["SubSysId"] + "", item["menucaption"] + "" };
Menu_ItemNew menu = new Menu_ItemNew();
Menu_Item menu = new Menu_Item();
menu.menuRow = item.Table.Columns.Contains("menuRow") && !string.IsNullOrEmpty(item["menuRow"] + "") ? Convert.ToInt32(item["menuRow"] + "") : 0;
menu.Name = menuid;
menu.Size = new Size(menuWidth, menuHeight);
menu.Size = new Size(menuWidthOld, menuHeightOld);
menu.menuNode = menuStruct.Substring(0, 2);
menu.SetMenuCaption(menuCaption);
menu.SetSubCaption(item["SubSysName"] + "-" + item["menucaption"]);
//menu.SetSubCaption(item["SearchMenuCaption"] + item["menucaption"]);
menu.SetRoundRadius = 20;
menu.Tag = menuTag;
menu.Click += OnMenuItemClick;
menu.GetButton().Tag = menuTag;
menu.GetButton().Click += OnMenuItemClick;
menu.SetMenuImg(File.Exists(defaultImg) ? Image.FromFile(defaultImg) : Resources.default_icon);
menu.SetMenuHoverImg(File.Exists(hoverImg) ? Image.FromFile(hoverImg) : Resources.default_icon);
// 116
@@ -1228,20 +1236,20 @@ namespace Lskj.Main.Control
//后台配置模块所在行数
if (menu.menuRow > 0)
{
int count = _menuItemList.Where(o => o.menuRow == menu.menuRow && o.menuNode == menu.menuNode).Count();
menuLeft = count == 0 ? 5 : count * Convert.ToInt32(2.92 * DpiX) + 5;
menuTop = menuHeight * (menu.menuRow - 1);
int count = _menuItemList.Cast<Menu_Item>().Where(o => o.menuRow == menu.menuRow && o.menuNode == menu.menuNode).Count();
menuLeft = count == 0 ? 5 : count * Convert.ToInt32(1.20 * DpiX) + 5;
menuTop = menuHeightOld * (menu.menuRow - 1);
menu.Location = new Point(menuLeft, menuTop);
}
else
{
menu.Location = new Point(menuLeft, menuTop);
menuLeft += Convert.ToInt32(2.92 * DpiX);
menuLeft += Convert.ToInt32(1.20 * DpiX);
// 换行显示
if (menuLeft + menuWidth > centerWidth)
{
menuLeft = 5;
menuTop += menuHeight;
menuTop += menuHeightOld;
}
}
// 默认显示
@@ -1257,7 +1265,7 @@ namespace Lskj.Main.Control
{
pl_center_main_middle.Controls.Add(menu);
}
List<Menu_ItemNew> controls = new List<Menu_ItemNew>();
List<UserControl> controls = new List<UserControl>();
if (_menus.TryGetValue(menuStruct.Substring(0, 2), out controls))
{
controls.Add(menu);
@@ -1850,9 +1858,16 @@ namespace Lskj.Main.Control
if (this._menuItemList == null || this._menuItemList.Count == 0) return;
DataTable notifys = MainImpl.GetNotifys(ERPInfo.Instance.SubSysId, ERPInfo.Instance.UserId);
DataTable ShortcutDt = MainImpl.GetGallerysByUserIdAndReviewAmount();
foreach (Menu_ItemNew Menu_ItemNew in _menuItemList)
foreach (UserControl menuControl in _menuItemList)
{
Menu_ItemNew.SetMenuNum(0);
if (menuControl is Menu_Item menu_Item)
{
menu_Item.SetMenuNum(0);
}
else if (menuControl is Menu_ItemNew menu_ItemNew)
{
menu_ItemNew.SetMenuNum(0);
}
}
//快捷栏
if (ShortcutDt != null)
@@ -1863,7 +1878,7 @@ namespace Lskj.Main.Control
if (items != null)
{
string groupMenuId = items["LMenuId"] + "";
Menu_ItemNew menuItem = this._menuItemList.Cast<Menu_ItemNew>().FirstOrDefault(x => x.Name == groupMenuId);
UserControl menuItem = this._menuItemList.Cast<UserControl>().FirstOrDefault(x => x.Name == groupMenuId);
Lskj.Control.CircleButton corLab = _quickPageHeaders[key];
corLab.Visible = true;
string number = items["amount"] + "";
@@ -1882,7 +1897,14 @@ namespace Lskj.Main.Control
corLab.SetMenuNum(int.Parse(number));
if (menuItem != null)
{
menuItem.SetMenuNum(int.Parse(number));
if (menuItem is Menu_Item menu_Item)
{
menu_Item.SetMenuNum(int.Parse(number));
}
else if (menuItem is Menu_ItemNew menu_ItemNew)
{
menu_ItemNew.SetMenuNum(int.Parse(number));
}
}
}
}
@@ -1897,17 +1919,17 @@ namespace Lskj.Main.Control
if (string.IsNullOrWhiteSpace(menuId) && string.IsNullOrWhiteSpace(moduleId)) continue;
Menu_ItemNew menuItem = null;
UserControl menuItem = null;
// 存在menuid则按照menuid来匹配数据,否则按照moduleid来匹配数据
if (!string.IsNullOrWhiteSpace(menuId))
{
menuItem = this._menuItemList.Cast<Menu_ItemNew>().FirstOrDefault(x => x.Name == menuId);
menuItem = this._menuItemList.Cast<UserControl>().FirstOrDefault(x => x.Name == menuId);
}
else
{
try
{
menuItem = this._menuItemList.Cast<Menu_ItemNew>().FirstOrDefault(x => (x.GetButton().Tag as string[])[1] == moduleId);
menuItem = this._menuItemList.Cast<UserControl>().FirstOrDefault(x => ((x is Menu_Item menu_Item && (menu_Item.GetButton().Tag as string[])[1] == moduleId) || ((x is Menu_ItemNew menu_ItemNew && (menu_ItemNew.GetButton().Tag as string[])[1] == moduleId))));
}
catch (Exception ex)
{
@@ -1916,18 +1938,34 @@ namespace Lskj.Main.Control
}
int markNum = 0;
if (menuItem != null && int.TryParse(num, out markNum))
menuItem.SetMenuNum(markNum);
{
if (menuItem is Menu_Item menu_Item)
{
menu_Item.SetMenuNum(markNum);
}
else if (menuItem is Menu_ItemNew menu_ItemNew)
{
menu_ItemNew.SetMenuNum(markNum);
}
}
}
//设置了数量sql的模块
foreach (string key in countSqls.Keys)
{
Menu_ItemNew menuItem = this._menuItemList.Cast<Menu_ItemNew>().FirstOrDefault(x => x.Name == key);
UserControl menuItem = this._menuItemList.Cast<UserControl>().FirstOrDefault(x => x.Name == key);
//DataRow dr = MainImpl.GetModuleDisplayQuantity(ReplaceHelper.ReplaceUserInfo(countSqls[key]));
//string num = dr["value"] + "";
string num = SqlHelper.ExecuteScalar(ReplaceHelper.ReplaceUserInfo(countSqls[key])) + "";
if (IsNumberic(num))
{
menuItem.SetMenuNum(int.Parse(num));
if (menuItem is Menu_Item menu_Item)
{
menu_Item.SetMenuNum(int.Parse(num));
}
else if (menuItem is Menu_ItemNew menu_ItemNew)
{
menu_ItemNew.SetMenuNum(int.Parse(num));
}
}
}
//默认模块,右上角
@@ -2358,8 +2396,8 @@ namespace Lskj.Main.Control
DataRow item_after = after.Tag != null ? after.Tag as DataRow : null;
if (item_before != null)
{
List<Menu_ItemNew> beforeButtons = new List<Menu_ItemNew>();
List<Menu_ItemNew> afterButtons = new List<Menu_ItemNew>();
List<UserControl> beforeButtons = new List<UserControl>();
List<UserControl> afterButtons = new List<UserControl>();
if (isFlowLayout)
{
pl_center_main_middle_FlowLayout.Hide();
@@ -2381,7 +2419,7 @@ namespace Lskj.Main.Control
}
else
{
foreach (Menu_ItemNew item in beforeButtons)
foreach (UserControl item in beforeButtons)
{
item.Visible = false;
}
@@ -2410,7 +2448,7 @@ namespace Lskj.Main.Control
{
if (_menus.TryGetValue(item_after["menustruct"] + "", out afterButtons))
{
foreach (Menu_ItemNew item in afterButtons)
foreach (UserControl item in afterButtons)
{
item.Visible = true;
}
+8 -5
View File
@@ -28,8 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.toolTip1 = new System.Windows.Forms.ToolTip();
this.btn_item_title = new System.Windows.Forms.Label();
this.btn_item_img = new System.Windows.Forms.Button();
this.lbl_mark_num = new System.Windows.Forms.Label();
@@ -80,12 +79,16 @@
//
this.cb_mark.BackColor = System.Drawing.Color.Red;
this.cb_mark.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.cb_mark.BorderColor = System.Drawing.Color.Transparent;
this.cb_mark.BorderThickness = 1F;
this.cb_mark.FlatAppearance.BorderSize = 0;
this.cb_mark.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cb_mark.Font = new System.Drawing.Font("Arial", 9F);
this.cb_mark.ForeColor = System.Drawing.Color.White;
this.cb_mark.ImageHover = null;
this.cb_mark.ImageNormal = null;
this.cb_mark.Location = new System.Drawing.Point(77, 0);
this.cb_mark.Name = "cb_mark";
this.cb_mark.Number = 0;
this.cb_mark.Radius = 24;
this.cb_mark.Size = new System.Drawing.Size(24, 24);
this.cb_mark.TabIndex = 4;
this.cb_mark.UseVisualStyleBackColor =
this
+3 -29
View File
@@ -146,7 +146,7 @@ namespace Lskj.Main.Control
//(sender as Button).BackgroundImageLayout = ImageLayout.Center;
try
{
this.BackColor = Color.White;
this.BackColor = Color.FromArgb(240, 240, 240);
this.Cursor = Cursors.Hand;
}
catch (Exception ex)
@@ -171,7 +171,7 @@ namespace Lskj.Main.Control
{
try
{
this.BackColor = Color.FromArgb(240, 240, 240);
this.BackColor = Color.White;
}
catch (Exception ex)
{
@@ -214,30 +214,4 @@ namespace Lskj.Main.Control
System.Drawing.Drawing2D.GraphicsPath oPath = new System.Drawing.Drawing2D.GraphicsPath();
int x = 0;
int y = 0;
int thisWidth = this.Width;
int thisHeight = this.Height;
int angle = _radius;
if (angle > 0)
{
System.Drawing.Graphics g = CreateGraphics();
oPath.AddArc(x, y, angle, angle, 180, 90); // 左上角
oPath.AddArc(thisWidth - angle, y, angle, angle, 270, 90); // 右上角
oPath.AddArc(thisWidth - angle, thisHeight - angle, angle, angle, 0, 90); // 右下角
oPath.AddArc(x, thisHeight - angle, angle, angle, 90, 90); // 左下角
oPath.CloseAllFigures();
Region = new System.Drawing.Region(oPath);
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
}
}
int thisWi