private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem menu = (ToolStripMenuItem)sender; ContextMenuStrip cms = (ContextMenuStrip)menu.Owner; ActivityControl activityControl = (ActivityControl)cms.SourceControl; var activity = activityControl.Activity; Activities.Remove(activity); Refresh(); }
private void Refresh() { workflowGroupBox.Controls.Clear(); for (int i = 0; i < Activities.Count; i++) { ActivityControl theActivityControl = new ActivityControl(); theActivityControl.Location = new Point(19, 19 + i * 83); theActivityControl.Size = new Size(162, 79); theActivityControl.Activity = Activities[i]; theActivityControl.Click += TheActivityControl_Click; theActivityControl.ContextMenuStrip = activityContextMenuStrip; workflowGroupBox.Controls.Add(theActivityControl); } }
private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem menu = (ToolStripMenuItem)sender; ContextMenuStrip cms = (ContextMenuStrip)menu.Owner; ActivityControl activityControl = (ActivityControl)cms.SourceControl; var activity = activityControl.Activity; int index = Activities.IndexOf(activity); if (index == Activities.Count - 1) { return; } Activities.Remove(activity); Activities.Insert(index + 1, activity); Refresh(); }
private void TheActivityControl_Click(object sender, EventArgs e) { ActivityControl activityControl = (ActivityControl)sender; activityPropertyGrid.SelectedObject = activityControl.Activity; activityPropertyGrid.Text = activityControl.Activity.GetType().Name; // set style var boldFont = new Font(activityControl.Font, FontStyle.Bold); var regularFont = new Font(activityControl.Font, FontStyle.Regular); foreach (var control in workflowGroupBox.Controls) { ActivityControl ac = (ActivityControl)control; ac.Font = regularFont; } activityControl.Font = boldFont; }