public void CommentHitTestError() { string test = "<p><!--OddPage--></p>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(test); Stylesheet s = new Stylesheet(); s.BindStyles(doc.NameTable); Rectangle rc = new Rectangle(0, 0, 500, int.MaxValue); using (IGraphics gr = new DummyGraphics()) { DrawContext ctx = new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null); LayoutEngine layoutEngine = new LayoutEngine(s); layoutEngine.Reflow(ctx, doc.DocumentElement); Console.WriteLine("Bounds {0}", layoutEngine.BoundingRect); for (int x = 0; x < layoutEngine.BoundingRect.Width; x += 10) { HitTestInfo hti = layoutEngine.GetHitTestInfo(gr, new Point(x, 8)); SelectionPoint sp = hti.SelectionPoint; Console.WriteLine("Hit test at {0} = {1}", x, sp); } } }
public void HitTestHandling() { string test = "<p><b>xxxxxxxxxxxxx</b></p>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(test); Stylesheet s = //Stylesheet.Load("c:/tmp/website/site.style", doc.NameTable); new Stylesheet(); s.BindStyles(doc.NameTable); Rectangle rc = new Rectangle(0, 0, 500, int.MaxValue); using (IGraphics gr = new DummyGraphics()) { DrawContext ctx = new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null); LayoutEngine layoutEngine = new LayoutEngine(s); layoutEngine.Reflow(ctx, doc.DocumentElement); layoutEngine.GetHitTestInfo(gr, new Point(141, 16)); } }