using CCWin; 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; namespace UAS_KanBan { public partial class Process : BaseForm { AutoSizeFormClass asc = new AutoSizeFormClass(); DataHelper dh = new DataHelper(); string Linecode; string Wccode; public Process(string LineCode, string WcCode) { InitializeComponent(); Linecode = LineCode; Wccode = WcCode; Line.Text = LineCode; 班制.Text = WcCode; } private void Process_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); Refresh_Tick(sender, e); Refresh.Tick += Refresh_Tick; Refresh.Interval = Setting.RefreshRate * 1000; Refresh.Start(); WindowState = FormWindowState.Maximized; } private void Refresh_Tick(object sender, EventArgs e) { DataTable dt = (DataTable)dh.ExecuteSql("select KBI_LINE_ZTL('" + Linecode + "','" + Wccode + "') from dual", "select"); string Data = dt.Rows[0][0].ToString(); string[] Item = Data.Split(':'); string[] ItemName = new string[Item.Length]; string[] ItemData = new string[Item.Length]; for (int i = 0; i < Item.Length; i++) { ItemName[i] = Item[i].Split('|')[0]; ItemData[i] = Item[i].Split('|')[1]; } for (int i = 0; i < Item.Length; i++) { for (int j = 0; j < Controls.Count; j++) { if (Controls[j].Name == ItemName[i]) { Controls[j].Text = ItemData[i]; } } } } private void Process_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); Line1.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y); Line2.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y); Line3.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y); Title.Location = new Point(Line1.Location.X + (Line2.Location.X - Line1.Location.X - Title.Size.Width) / 2, TopLine.Location.Y + (BottomLine.Location.Y - TopLine.Location.Y - Title.Size.Height) / 2); Title2.Location = new Point(Title.Location.X, Title2.Location.Y); Logo.Size = new Size(Line1.Location.X - 20, BottomLine.Location.Y - TopLine.Location.Y - 20); WorkShift_label.Location = new Point(Line2.Location.X + (Line3.Location.X - Line2.Location.X - WorkShift_label.Size.Width) / 2, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2); LineCode_label.Location = new Point(Line2.Location.X + (Line3.Location.X - Line2.Location.X - LineCode_label.Size.Width) / 2, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2); Line.Location = new Point(Line.Location.X, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2); 班制.Location = new Point(班制.Location.X, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2); } private void Process_FormClosing(object sender, FormClosingEventArgs e) { Refresh.Stop(); } private void Process_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { Hide(); Setting set = new Setting(); set.ShowDialog(); Close(); } } } }