private Transform2d GetTextPositionTransform(GFNFont fnt, string txt, double x, double y, double size, double angle, TextAlign align, Transform2d t) { //computes the transformation needed to transform text drawn at origo to get to the wanted position Transform2d res = Transform2d.Translate(x, y); if (angle != 0.0) { res = Transform2d.Rotate(angle) * res; } if (align != TextAlign.BaseLeft) { double dx, dy; GetTextAlignDXDY(fnt, txt, size, align, out dx, out dy); res = Transform2d.Translate(dx, dy) * res; } res = Transform2d.Scale(size / fnt.CapHeight) * res; if (t != null) { return(res * t); } return(res); }
void OnDrawAreaWheel(object sender, WheelEventArgs e) { Drawing drw = CurrentDrawing; if (drw != null) { double scale; if (e.Delta < 0) { scale = 0.8; } else { scale = 1.0 / 0.8; } drw.ViewTransform = drw.ViewTransform * Transform2d.Translate(-cursorpixel.X, -cursorpixel.Y) * Transform2d.Scale(scale) * Transform2d.Translate(cursorpixel.X, cursorpixel.Y); drawarea.Redraw(); } }