void LoadInk(string path) { if (false == File.Exists(path)) { throw new Exception("wrong path"); } m_Strokes.Clear(); CJStroke curStroke = null; FileStream fs = File.Open(path, FileMode.Open); StreamReader sr = new StreamReader(fs); while (false == sr.EndOfStream) { string newLine = sr.ReadLine(); if (newLine.StartsWith("NewStroke")) { curStroke = new CJStroke(); this.m_Strokes.Add(curStroke); } else { string[] strs = newLine.Split(",".ToCharArray()); double x = double.Parse(strs[0]); double y = double.Parse(strs[1]); curStroke.AddPoint(x, y); } } }
private void PanelMainFrame_MouseDown(object sender, MouseEventArgs e) { bBtnDown = true; if (null == curAnno) { curAnno = new Annotation(); curAnno.StartFrame = CurFrameNum; curAnno.EndFrame = int.MaxValue; ListAnnos.Add(curAnno); } curStroke = new CJStroke(); // todo curStroke.color = formAnnotationOld.GetPenColor(); curStroke.penWidth = (float)formAnnotationOld.GetPenWidth(); curStroke.Add(new CJPoint((double)e.X / this.Width, (double)e.Y / this.Height)); curAnno.Add(curStroke); }
private void PanelMainFrame_MouseUp(object sender, MouseEventArgs e) { bBtnDown = false; curStroke = null; }