private void annotationListBox_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); AnnotationListItem item = (AnnotationListItem)annotationListBox.Items[e.Index]; e.Graphics.DrawString(item.annotation.Point.ToString("f3"), annotationListBox.Font, new SolidBrush(annotationListBox.ForeColor), new PointF((float)e.Bounds.X, (float)e.Bounds.Y)); string label; if (item.annotation.Label.Contains(" ")) { label = "\"" + item.annotation.Label + "\""; } else { label = item.annotation.Label; } e.Graphics.DrawString(label, annotationListBox.Font, new SolidBrush(annotationListBox.ForeColor), new PointF((float)e.Bounds.X + ((e.Bounds.Width / 2) - (e.Bounds.Height * 2)), (float)e.Bounds.Y)); Rectangle colorSampleBox = new Rectangle(e.Bounds.Location, e.Bounds.Size); colorSampleBox.X = e.Bounds.Right - e.Bounds.Height * 2; colorSampleBox.Location.Offset(-5, 0); e.Graphics.FillRectangle(new SolidBrush(ownerGraphForm.ZedGraphControl.GraphPane.Chart.Fill.Color), colorSampleBox); int middle = colorSampleBox.Y + colorSampleBox.Height / 2; e.Graphics.DrawLine(new Pen(item.annotation.Color, item.annotation.Width), colorSampleBox.Left, middle, colorSampleBox.Right, middle); e.DrawFocusRectangle(); }
private void editAnnotationButton_Click(object sender, EventArgs e) { AnnotationListItem item = (AnnotationListItem)annotationListBox.SelectedItem; AnnotationEditAddEditDialog dialog = new AnnotationEditAddEditDialog(ownerGraphForm.ZedGraphControl.GraphPane.Chart.Fill.Color, item.annotation); if (dialog.ShowDialog() == DialogResult.OK) { item.annotation = dialog.annotation; annotationListBox.Refresh(); } }
private void okButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; PointDataMap <SeemsPointAnnotation> annotationMap = (ownerGraphForm.CurrentScan.IsMassSpectrum ? ownerGraphForm.AnnotationSettings.ScanPointAnnotations : ownerGraphForm.AnnotationSettings.ChromatogramPointAnnotations); annotationMap.Clear(); foreach (object itr in annotationListBox.Items) { AnnotationListItem item = (AnnotationListItem)itr; annotationMap[item.annotation.Point] = item.annotation; } this.Close(); }