private void OnCanvasPrePaint(NCanvasPaintEventArgs args) { NCanvas canvas = args.TargetNode as NCanvas; if (canvas == null) { return; } // Create a transform matrix for the graphics path NMatrix matrix = NMatrix.CreateRotationMatrix(m_PathAngle * NAngle.Degree2Rad, NPoint.Zero); matrix.Translate(m_PathPositionX, m_PathPositionY); // Create a graphics path containing a rectangle and transform it NGraphicsPath path = new NGraphicsPath(); path.AddRectangle(0, 0, RectWidth, RectHeight); path.Transform(matrix); // Paint the graphics path NPaintVisitor pv = args.PaintVisitor; pv.SetStroke(m_Stroke); pv.SetFill(m_ImageFill); pv.PaintPath(path); // Paint a border around the canvas pv.ClearFill(); pv.SetStroke(NColor.Black, 1); pv.PaintRectangle(0, 0, canvas.Width, canvas.Height); }