public SketchAnnotationDlg(SketchAnnotation note) { this.InitializeComponent(); this.fNote = note; this.ColorPanel.Color1 = this.fForeColor; this.ColorPanel.Color2 = this.fBackColor; this.SizeBox.Value = (Decimal)this.fToolSize; this.TitleBox.Text = this.fNote.Title; this.DescBox.Text = this.fNote.Content; this.SketchBox.Image = this.fNote.Sketch.Clone() as Image; }
public static void Render(Annotation a, Rectangle rect, Font f, Graphics g, bool selected, bool showicon) { if (showicon) { Image image = Annotations.GetImage(a); if (image != null) { g.DrawImage(image, rect.X, rect.Y); } if (image != null) { rect.X += image.Width; rect.Width -= image.Width; } } Brush brush = SystemBrushes.WindowText; if (selected) { brush = SystemBrushes.HighlightText; } StringFormat format = new StringFormat(); format.Trimming = StringTrimming.EllipsisWord; format.FormatFlags |= StringFormatFlags.LineLimit; float num = 0.0f; if (a.Title != "") { Font font = new Font(f, f.Style | FontStyle.Bold); num = g.MeasureString(a.Title, font, rect.Width).Height; g.DrawString(a.Title, font, brush, (RectangleF)rect, format); } rect.Y += (int)num; rect.Height -= (int)num; if (a is SketchAnnotation) { rect.Inflate(-1, -1); SketchAnnotation sketchAnnotation = a as SketchAnnotation; g.DrawImage(sketchAnnotation.Sketch, rect); } else { string s = Annotations.SimplifyContent(a); g.DrawString(s, f, brush, (RectangleF)rect, format); } }
public static bool Open(Annotation a) { TextAnnotation note1 = a as TextAnnotation; if (note1 != null) { return(new TextAnnotationDlg(note1).ShowDialog() == DialogResult.OK); } LinkAnnotation note2 = a as LinkAnnotation; if (note2 != null) { return(new FileLinkAnnotationDlg(note2).ShowDialog() == DialogResult.OK); } SketchAnnotation note3 = a as SketchAnnotation; if (note3 != null) { return(new SketchAnnotationDlg(note3).ShowDialog() == DialogResult.OK); } return(false); }