using System; using System.Data; using System.Drawing; using System.Windows.Forms; using UAS_KanBan.CustomControl; namespace UAS_KanBan { public partial class Process : BaseForm { AutoSizeFormClass asc = new AutoSizeFormClass(); DataHelper dh = new DataHelper(); public Process(string LineCode, string WcCode) { InitializeComponent(); Line.Text = LineCode; wccode.Text = WcCode; int WorkHeight = Screen.PrimaryScreen.Bounds.Width; if (WorkHeight <= 1024) { for (int i = 0; i < this.Controls.Count; i++) { if (Controls[i] is Label || Controls[i] is ValueLabel) { if (Controls[i].Tag != null && Controls[i].Tag.ToString() == "AutoFont") Controls[i].Font = new Font("宋体", Controls[i].Font.Size - 15, FontStyle.Bold); else Controls[i].Font = new Font("宋体", Controls[i].Font.Size - 8, FontStyle.Bold); } } } } private void Process_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); Refresh_Tick(sender, e); RefreshData.Tick += Refresh_Tick; RefreshData.Interval = Setting.RefreshRate * 1000; RefreshData.Start(); WindowState = FormWindowState.Maximized; } private void Refresh_Tick(object sender, EventArgs e) { try { DataTable dt = (DataTable)dh.ExecuteSql("select KBI_LINE_ZTL('" + Line.Text + "','" + wccode.Text + "') 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]; } } } } catch (Exception) { } } 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); 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); Logo.Size = new Size(Line1.Location.X - 20, BottomLine.Location.Y - TopLine.Location.Y - 20); 机型.Location = new Point(机型_label.Location.X + 机型_label.Width + 15, 机型_label.Location.Y); 投入.Location = new Point(投入_label.Location.X + 机型_label.Width + 15, 投入_label.Location.Y); Dash.Location = new Point(投入.Location.X + 投入.Size.Width, 投入_label.Location.Y); 产出.Location = new Point(Dash.Location.X + Dash.Size.Width, 投入_label.Location.Y); 一次通过.Location = new Point(产出_label.Location.X + 机型_label.Width + 15, 产出_label.Location.Y); 直通率.Location = new Point(直通率_label.Location.X + 直通率_label.Width + 5, 直通率_label.Location.Y); 收益率.Location = new Point(收益率_label.Location.X + 收益率_label.Width + 5, 收益率_label.Location.Y); 故障数.Location = new Point(故障数_label.Location.X + 故障数_label.Width + 5, 故障数_label.Location.Y); 机型.MaximumSize = new Size(直通率_label.Location.X - 机型_label.Location.X - 机型_label.Width - 15, 0); } private void Process_FormClosing(object sender, FormClosingEventArgs e) { RefreshData.Stop(); } private void Process_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { Close(); } } private void 投入_SizeChanged(object sender, EventArgs e) { 投入.Location = new Point(投入_label.Location.X + 机型_label.Width + 15, 投入_label.Location.Y); Dash.Location = new Point(投入.Location.X + 投入.Size.Width, 投入_label.Location.Y); 产出.Location = new Point(Dash.Location.X + Dash.Size.Width, 投入_label.Location.Y); } } }