/// <summary> /// 获取指定类型的环节 /// </summary> /// <param name="tacheType">环节类型</param> /// <returns>环节</returns> private WorkTache FirstOrDefault(WorkTacheType tacheType) { foreach (Control item in panelWorkFlow.Controls) { if (item is WorkTache) { WorkTache workTache = item as WorkTache; if (workTache.TacheType == tacheType) { return(workTache); } } } return(null); }
public WorkTache() { InitializeComponent(); this.Cursor = Cursors.Hand; this.BackgroundImageLayout = ImageLayout.Stretch; this.Height = 72; this.Width = 73; this.TextAlign = ContentAlignment.BottomCenter; this.FlatAppearance.BorderSize = 0; this.FlatStyle = FlatStyle.Flat; this.UseVisualStyleBackColor = false; this.AutoSize = false; this.radio.FlatAppearance.BorderSize = 0; this.radio.FlatStyle = FlatStyle.Flat; this.radio.UseVisualStyleBackColor = false; this.radio.BackColor = Color.Transparent; this.radio.AutoSize = false; this.radio.Left = this.Width / 2 - 5; this.radio.Top = this.Height / 2 - 5; this.radio.Width = 10; this.radio.Height = 10; this.radio.Text = string.Empty; GraphicsPath circlePath = new GraphicsPath(); circlePath.AddEllipse(0, 0, this.radio.Width, this.radio.Height); this.radio.Region = new Region(circlePath); this.radio.MouseDown += new MouseEventHandler(radio_MouseDown); this.radio.MouseEnter += new EventHandler(radio_MouseEnter); this.radio.MouseLeave += new EventHandler(radio_MouseLeave); tacheType = WorkTacheType.Normal; this.Controls.Add(radio); this.LoadBackgroudImage("Tache.png"); }