public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { m_canvaswrapper = new CanvasWrapper(this); m_owner = owner; m_model = datamodel; InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); //忽略窗口信息减少闪烁,由控件来绘制自身 this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //控件将首先绘制到缓冲区而不是绘制到屏幕。 m_commandType = eCommandType.select; m_cursors.AddCursor(eCommandType.select, Cursors.Arrow); //设置选中光标类型 m_cursors.AddCursor(eCommandType.draw, Cursors.Cross); //设置画图光标类型 m_cursors.AddCursor(eCommandType.pan, "hmove.cur"); //设置移动画面光标类型 m_cursors.AddCursor(eCommandType.move, Cursors.SizeAll); //设置移动光标类型 m_cursors.AddCursor(eCommandType.edit, Cursors.Cross); //设置编辑光标类型 UpdateCursor(); //更新光标 m_moveHelper = new MoveHelper(this); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); }
public CanvasCtrl(ICanvasOwner owner, IModel datamodel) { m_canvaswrapper = new CanvasWrapper(this); m_owner = owner; m_model = datamodel; InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); m_commandType = eCommandType.select; m_cursors.AddCursor(eCommandType.select, Cursors.Arrow); m_cursors.AddCursor(eCommandType.draw, Cursors.Cross); m_cursors.AddCursor(eCommandType.pan, "hmove.cur"); m_cursors.AddCursor(eCommandType.move, Cursors.SizeAll); m_cursors.AddCursor(eCommandType.edit, Cursors.Cross); UpdateCursor(); m_moveHelper = new MoveHelper(this); m_nodeMoveHelper = new NodeMoveHelper(m_canvaswrapper); }