private void Create() { usso = new USynMinSetOpen(); uSynMin4 = new USynMin(); uSynMin3 = new USynMin(); uSynMin2 = new USynMin(); uSynMin1 = new USynMin(); usso.Location = new System.Drawing.Point(108, 53); usso.Name = "usso"; usso.TabIndex = 4; usso.Visible = false; uSynMin4.BackColor = System.Drawing.Color.Transparent; uSynMin4.BackgroundImage = SetSyn.Properties.Resources.mulv13; uSynMin4.Location = new System.Drawing.Point(0, 165); uSynMin4.Margin = new System.Windows.Forms.Padding(0); uSynMin4.Name = "uSynMin4"; uSynMin4.Size = new System.Drawing.Size(349, 55); uSynMin4.TabIndex = 3; uSynMin4.Tag = "4"; uSynMin3.Location = new System.Drawing.Point(0, 110); uSynMin3.Margin = new System.Windows.Forms.Padding(0); uSynMin3.Name = "uSynMin3"; uSynMin3.Size = new System.Drawing.Size(349, 55); uSynMin3.TabIndex = 2; uSynMin3.Tag = "3"; uSynMin2.Location = new System.Drawing.Point(0, 55); uSynMin2.Margin = new System.Windows.Forms.Padding(0); uSynMin2.Name = "uSynMin2"; uSynMin2.Size = new System.Drawing.Size(349, 55); uSynMin2.TabIndex = 1; uSynMin2.Tag = "2"; uSynMin1.BackColor = System.Drawing.Color.Transparent; uSynMin1.BackgroundImage = SetSyn.Properties.Resources.mulv111; uSynMin1.Location = new System.Drawing.Point(0, 0); uSynMin1.Margin = new System.Windows.Forms.Padding(0); uSynMin1.Name = "uSynMin1"; uSynMin1.Size = new System.Drawing.Size(349, 55); uSynMin1.TabIndex = 0; uSynMin1.Tag = "1"; this.panel1.Controls.Add(this.usso); this.panel1.Controls.Add(this.uSynMin4); this.panel1.Controls.Add(this.uSynMin3); this.panel1.Controls.Add(this.uSynMin2); this.panel1.Controls.Add(this.uSynMin1); }
public void pictureBox1_Click(object sender, EventArgs e) { try { if (pictureBox2.Visible) { USynMinSetOpen usso = this.Parent.Controls["usso"] as USynMinSetOpen; if (open) { open = false; usso.dataGridView1.EndEdit(); usso.save(); db.SetPIVAsDB(string.Format("UPDATE [dbo].[SynSet] SET [SynStarTime] = '{0}' ,[SynEndTime] = '{1}',[SyncSpaceTime] = '{2}' WHERE [SynCode]='{3}'", USynMinSet.begin, USynMinSet.end, USynMinSet.space, USynMinSet.SynCode).ToString()); pictureBox1.BackgroundImage = (Image)SetSyn.Properties.Resources.ResourceManager.GetObject("mulv14"); foreach (Control c in this.Parent.Controls) { c.Enabled = true; } usso.Visible = false; switch (Tag.ToString()) { case "1": { label1.Text = "一次"; label2.Text = "每天定时执行一次同步"; label3.Text = "在" + (USynMinSet.begin.Contains(",") ? USynMinSet.begin.Split(',')[0] : USynMinSet.begin) + "点执行"; break; } case "2": { label1.Text = "时段"; label2.Text = "每天的一个时间段内间隔执行同步"; label3.Text = "间隔" + USynMinSet.space + "分钟执行"; break; } case "3": { label1.Text = "全天"; label2.Text = "全天间隔执行同步"; label3.Text = "间隔" + USynMinSet.space + "分钟执行"; break; } case "4": { label1.Text = "手动"; pictureBox1.Visible = false; break; } } } else { open = true; pictureBox1.BackgroundImage = (Image)SetSyn.Properties.Resources.ResourceManager.GetObject("mulv11"); if (Tag.ToString() != "4") { usso.usm = this; usso.BringToFront(); usso.Location = new Point(usso.Location.X, this.Location.Y + this.Size.Height - 2); usso.USynMinSetOpen_Load(sender, e); usso.Visible = true; usso.Refresh(); } foreach (Control c in this.Parent.Controls) { c.Enabled = false; } usso.Enabled = true; this.Enabled = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }