public PaintTransformOffsetBy ( int dx, int dy ) : |
||
dx | int | |
dy | int | |
return |
public override void PaintBackground(IVwGraphics vg, PaintTransform ptrans) { base.PaintBackground(vg, ptrans); PaintTransform childTrans = ptrans.PaintTransformOffsetBy(Left, Top); for (Box box = FirstVisibleBox(vg, ptrans); box != null && !IsAfterVisibleBoxes(box, vg, ptrans); box = box.Next) { box.PaintBackground(vg, childTrans); } }
public override void PaintForeground(IVwGraphics vg, PaintTransform ptrans) { base.PaintForeground(vg, ptrans); PaintTransform childTrans = ptrans.PaintTransformOffsetBy(Left, Top); for (Box box = FirstVisibleBox(vg, ptrans); box != null && !IsAfterVisibleBoxes(box, vg, ptrans); box = box.Next) { //vg.PushClipRect(new Rect(box.Left, box.Top, box.Right, box.Bottom)); box.PaintForeground(vg, childTrans); } }
/// <summary> /// If there is a leaf box at the specified position, return it. Also return the paint transform that should be /// passed to operations on that box. /// Enhance JohnT: should probably always return something, if box contains any leaf? /// Where is in drawing coords. /// </summary> public override LeafBox FindBoxAt(Point where, PaintTransform ptrans, out PaintTransform leafBoxTransform) { var childTransform = ptrans.PaintTransformOffsetBy(Left, Top); var hit = childTransform.ToLayout(where); Box best = null; // if we don't find a box containing the point, this is the closest on the same line. int bestDistance = int.MaxValue; for (Box current = FirstBox; current != null; current = current.Next) { // If we're not even on the current line, keep trying. if (hit.Y > current.Bottom) { continue; } if (hit.Y < current.Top) { continue; } // If it's within the borders of this box, return it unconditionally. if (hit.X <= current.Right && hit.X >= current.Left) { return(current.FindBoxAt(where, childTransform, out leafBoxTransform)); } // If we're on the right line, we'll return this if we don't find a better. int distance = hit.X - current.Right; if (hit.X < current.Left) { distance = current.Left - hit.X; } if (distance < bestDistance) { bestDistance = distance; best = current; } } if (best != null) { return(best.FindBoxAt(where, childTransform, out leafBoxTransform)); } leafBoxTransform = ptrans; // arbitrary. return(null); }
public override void PaintBackground(IVwGraphics vg, PaintTransform ptrans) { base.PaintBackground(vg, ptrans); PaintTransform childTrans = ptrans.PaintTransformOffsetBy(Left, Top); for (Box box = FirstVisibleBox(vg, ptrans); box != null && !IsAfterVisibleBoxes(box, vg, ptrans); box = box.Next) box.PaintBackground(vg, childTrans); }
public override void PaintForeground(IVwGraphics vg, PaintTransform ptrans) { base.PaintForeground(vg, ptrans); PaintTransform childTrans = ptrans.PaintTransformOffsetBy(Left, Top); for (Box box = FirstVisibleBox(vg, ptrans); box != null && !IsAfterVisibleBoxes(box, vg, ptrans); box = box.Next) { //vg.PushClipRect(new Rect(box.Left, box.Top, box.Right, box.Bottom)); box.PaintForeground(vg, childTrans); } }
/// <summary> /// If there is a leaf box at the specified position, return it. Also return the paint transform that should be /// passed to operations on that box. /// Enhance JohnT: should probably always return something, if box contains any leaf? /// Where is in drawing coords. /// </summary> public override LeafBox FindBoxAt(Point where, PaintTransform ptrans, out PaintTransform leafBoxTransform) { var childTransform = ptrans.PaintTransformOffsetBy(Left, Top); var hit = childTransform.ToLayout(where); Box best = null; // if we don't find a box containing the point, this is the closest on the same line. int bestDistance = int.MaxValue; for (Box current = FirstBox; current != null; current = current.Next) { // If we're not even on the current line, keep trying. if (hit.Y > current.Bottom) continue; if (hit.Y < current.Top) continue; // If it's within the borders of this box, return it unconditionally. if (hit.X <= current.Right && hit.X >= current.Left) return current.FindBoxAt(where, childTransform, out leafBoxTransform); // If we're on the right line, we'll return this if we don't find a better. int distance = hit.X - current.Right; if (hit.X < current.Left) distance = current.Left - hit.X; if (distance < bestDistance) { bestDistance = distance; best = current; } } if (best != null) return best.FindBoxAt(where, childTransform, out leafBoxTransform); leafBoxTransform = ptrans; // arbitrary. return null; }