From 40ffa6945dfe0a1c407e5df3ae86658aa7374c23 Mon Sep 17 00:00:00 2001
From: lg <123456>
Date: 星期四, 20 十一月 2025 15:24:35 +0800
Subject: [PATCH] 删除caa锁,禁用采购到货明细选择编辑

---
 DevApp/Gs.DevApp/UserControl/Toast.cs |   79 +++++++++++++++++++++++----------------
 1 files changed, 46 insertions(+), 33 deletions(-)

diff --git a/DevApp/Gs.DevApp/UserControl/Toast.cs b/DevApp/Gs.DevApp/UserControl/Toast.cs
index de950d3..15d856e 100644
--- a/DevApp/Gs.DevApp/UserControl/Toast.cs
+++ b/DevApp/Gs.DevApp/UserControl/Toast.cs
@@ -1,12 +1,6 @@
-锘縰sing DevExpress.XtraEditors;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
+锘縰sing System;
+using System.Configuration;
 using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows.Forms;
 
 namespace Gs.DevApp
@@ -15,27 +9,56 @@
     {
         private System.Windows.Forms.Timer tmr;
         private System.Windows.Forms.Timer tmr2;
+
         /// <summary>
-        /// Shows a message windows. 3 sec is the suggested time
+        /// 
         /// </summary>
-        /// <param name="messageText">Message</param>
-        /// <param name="vanishingSeconds">Showing time</param>
-        public Toast(System.Drawing.Color bgColor,string messageText, int vanishingSeconds = 2)
+        /// <param name="it">1鎴愬姛锛�-1澶辫触</param>
+        /// <param name="messageText"></param>
+        /// <param name="vanishingSeconds">鍔ㄧ敾寤堕暱鏃堕棿</param>
+        public Toast(int it, string messageText, int vanishingSeconds = 5)
         {
             InitializeComponent();
-            this.Appearance.BackColor = bgColor;
+            this.StartPosition = FormStartPosition.CenterScreen; // 璁剧疆绐椾綋灞呬腑鏄剧ず
+            this.AutoScaleMode = AutoScaleMode.Font; // 鏍规嵁绯荤粺瀛椾綋澶у皬
+            int clientWidth=0;
+            int clientHeight = 0;
+            this.lbMsg.BackColor = System.Drawing.Color.Firebrick;
+            this.lbMsg.Font = new System.Drawing.Font("Tahoma", 38F);
+            this.lbMsg.ForeColor = System.Drawing.Color.White;
+            messageText = messageText.Replace("@n", "\r\n");
+            using (Graphics graphics = this.CreateGraphics())
+            {
+                Size textSize = TextRenderer.MeasureText(messageText, lbMsg.Font);
+                clientWidth = (int)textSize.Width + 10;
+                clientHeight= (int)textSize.Height+10;
+            }
+            this.ClientSize = new System.Drawing.Size(clientWidth, clientHeight);
+            this.StartPosition = FormStartPosition.CenterScreen; // 璁剧疆绐椾綋灞呬腑鏄剧ず
+            this.AutoScaleMode = AutoScaleMode.Font; // 鏍规嵁绯荤粺瀛椾綋澶у皬
+            this.CenterToScreen();
+            try
+            {
+                string _vanishingSeconds = ConfigurationManager.AppSettings["ToastSeconds"];
+                if (!string.IsNullOrEmpty(_vanishingSeconds))
+                    vanishingSeconds = int.Parse(_vanishingSeconds);
+            }
+            catch (Exception)
+            {
+
+            }
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Toast));
+            if (it > 0)
+            {
+                this.lbMsg.BackColor = System.Drawing.Color.SeaGreen;
+            }
+            else
+            {
+                this.lbMsg.BackColor = System.Drawing.Color.Firebrick;
+            }
             double elapsedTime = 0;
-            testo.Text = messageText;
+            lbMsg.Text = messageText;
             double vanishingMilliSeconds = vanishingSeconds * 1000;
-
-            // message dimensions
-            //this.Width = testo.Width + 50;
-            //this.Height = testo.Height + 50;
-
-            //text position
-           // testo.Location = new Point((this.Width / 2) - (testo.Width / 2), (this.Height / 2) - (testo.Height / 2));
-
-            //first timer
             tmr = new System.Windows.Forms.Timer();
             tmr.Tick += delegate
             {
@@ -62,15 +85,5 @@
             tmr2.Start();
         }
 
-        private void VanishingMessage_Paint(object sender, PaintEventArgs e)
-        {
-            Graphics g = this.CreateGraphics();
-            Pen p = new Pen(Color.DarkRed);
-            SolidBrush sb = new SolidBrush(Color.DarkRed);
-            Rectangle r = this.DisplayRectangle;
-            r.Width -= 1;
-            r.Height -= 1;
-            g.DrawRectangle(p, r);
-        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3