private void UserControl1_Load(object sender, EventArgs e) { _myFont = new Font("Lucida Console", 8); _myBrush = new SolidBrush(Color.Black); _myBlueBrush = new SolidBrush(Color.Blue); _myPen = new System.Drawing.Pen(Color.Black); _myPen.ResetTransform(); _myPen.Width = 1; _myPen.StartCap = LineCap.Round; _myPen.EndCap = LineCap.Round; _myPen.DashStyle = DashStyle.Solid; _myBluePen = new System.Drawing.Pen(Color.Blue); _myBluePen.ResetTransform(); _myBluePen.Width = 1; _myBluePen.StartCap = LineCap.ArrowAnchor; _myBluePen.EndCap = LineCap.Round; _myBluePen.DashStyle = DashStyle.Solid; }
private void RulerControl_Load(object sender, System.EventArgs e) { _myFont = new Font("Lucida Console", 8); _myBrush = new SolidBrush(Color.Black); _myStringFormat = new StringFormat(); _myStringFormat.FormatFlags = StringFormatFlags.NoWrap; _myPen = new System.Drawing.Pen(Color.Black); _myPen.ResetTransform(); _myPen.Width = 1; _myPen.StartCap = LineCap.Round; _myPen.EndCap = LineCap.Round; _myPen.DashStyle = DashStyle.Solid; _myBluePen = new System.Drawing.Pen(Color.Blue); _myBluePen.ResetTransform(); _myBluePen.Width = 1; _myBluePen.StartCap = LineCap.ArrowAnchor; _myBluePen.EndCap = LineCap.Round; _myBluePen.DashStyle = DashStyle.Solid; _myLines = new ArrayList(); DrawLines(); }
public void Transform_Operations () { using (Pen p = new Pen (Brushes.Red)) { Matrix clone = p.Transform.Clone (); Matrix mul = clone.Clone (); clone.Multiply (mul, MatrixOrder.Append); p.MultiplyTransform (mul, MatrixOrder.Append); Assert.AreEqual (p.Transform, clone, "Multiply/Append"); clone.Multiply (mul, MatrixOrder.Prepend); p.MultiplyTransform (mul, MatrixOrder.Prepend); Assert.AreEqual (p.Transform, clone, "Multiply/Prepend"); clone.Rotate (45, MatrixOrder.Append); p.RotateTransform (45, MatrixOrder.Append); Assert.AreEqual (p.Transform, clone, "Rotate/Append"); clone.Rotate (45, MatrixOrder.Prepend); p.RotateTransform (45, MatrixOrder.Prepend); Assert.AreEqual (p.Transform, clone, "Rotate/Prepend"); clone.Scale (0.25f, 2, MatrixOrder.Append); p.ScaleTransform (0.25f, 2, MatrixOrder.Append); Assert.AreEqual (p.Transform, clone, "Scale/Append"); clone.Scale (0.25f, 2, MatrixOrder.Prepend); p.ScaleTransform (0.25f, 2, MatrixOrder.Prepend); Assert.AreEqual (p.Transform, clone, "Scale/Prepend"); clone.Translate (10, 20, MatrixOrder.Append); p.TranslateTransform (10, 20, MatrixOrder.Append); Assert.AreEqual (p.Transform, clone, "Translate/Append"); clone.Translate (30, 40, MatrixOrder.Prepend); p.TranslateTransform (30, 40, MatrixOrder.Prepend); Assert.AreEqual (p.Transform, clone, "Translate/Prepend"); clone.Reset (); p.ResetTransform (); Assert.AreEqual (p.Transform, clone, "Reset"); } }
public void ResetTransform () { using (Matrix m = new Matrix (2, 0, 0, 2, 10, -10)) { using (Pen p = new Pen (Brushes.Red)) { p.Transform = m; Assert.IsFalse (p.Transform.IsIdentity, "Transform.IsIdentity"); p.ResetTransform (); Assert.IsTrue (p.Transform.IsIdentity, "Reset.IsIdentity"); } } }
private void UserControl1_Load(object sender, EventArgs e) { _myFont = new Font("Lucida Console", 8); _myBrush = new SolidBrush(Color.Black); _myBlueBrush = new SolidBrush(Color.Blue); _myPen = new System.Drawing.Pen(Color.Black); _myPen.ResetTransform(); _myPen.Width = 1; _myPen.StartCap = LineCap.Round; _myPen.EndCap = LineCap.Round; _myPen.DashStyle = DashStyle.Solid; _myBluePen = new System.Drawing.Pen(Color.Blue); _myBluePen.ResetTransform(); _myBluePen.Width = 1; _myBluePen.StartCap = LineCap.ArrowAnchor; _myBluePen.EndCap = LineCap.Round; _myBluePen.DashStyle = DashStyle.Solid; }
void CheckMethods (Pen pen, String tag) { // Try modifying a SystemPen by calling methods. // ArgumentException must be thrown in some cases. /* try { // NotImplemented pen.SetLineCap (LineCap.Flat, LineCap.Round, DashCap.Triangle); Assert.Fail (tag + "#1: must throw ArgumentException"); } catch (ArgumentException) { Assert.IsTrue (tag + "#1", true); } */ pen.ResetTransform (); pen.RotateTransform (90); pen.ScaleTransform (2, 1); pen.TranslateTransform (10, 20); pen.MultiplyTransform (new Matrix ()); pen.Clone (); try { pen.Dispose (); Assert.Fail (tag + "#8: must throw ArgumentException"); } catch (ArgumentException) { Assert.IsTrue (true, tag + "#8"); } }