public Canvas() { InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.UserPaint, true); this.DoubleBuffered = true; this.ResizeRedraw = true; this.UpdateStyles(); m_camera = new Camera(); m_origin = new Point(); m_origin.X = this.Width / 2; m_origin.Y = this.Height / 2; m_axes = new CoordinateAxes(m_origin); this.BackColor = Color.White; m_axesPlacement = AxesPosition.Center; m_list = new List <Sample3DObj>(); m_list.Add(new Sample3DObj()); m_action = ActionMode.Rotate; }
public void SetAxesPosition(AxesPosition position) { m_axesPlacement = position; switch (m_axesPlacement) { case AxesPosition.TopLeft: { m_axes.SetPosition(-(this.Width / 2 - 60), -(this.Height / 2 - 60)); break; } case AxesPosition.TopRight: { m_axes.SetPosition((this.Width / 2 - 60), -(this.Height / 2 - 60)); break; } case AxesPosition.BottomLeft: { m_axes.SetPosition(-(this.Width / 2 - 60), (this.Height / 2 - 60)); break; } case AxesPosition.BottomRight: { m_axes.SetPosition((this.Width / 2 - 60), (this.Height / 2 - 60)); break; } case AxesPosition.Center: { m_axes.SetPosition(0, 0); break; } } }