www.pudn.com > WorkflowDesigner.rar > DesignerVisualObject.cs, change:2007-11-16,size:3356b


using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Drawing; 
 
namespace WorkflowDesigner.Designer 
{ 
    /// <summary> 
    /// 可视化对象基类 
    /// </summary> 
    public class DesignerVisualObject 
    { 
        #region 字段 
        /// <summary> 
        /// 是否被选中 
        /// </summary> 
        private bool _isSelected = false; 
 
        /// <summary> 
        /// 所占表格的大小 
        /// </summary> 
        protected const int GridSize = 10; 
 
        #endregion 
 
        #region 属性 
        /// <summary> 
        /// 是否被选中 
        /// </summary> 
        public bool IsSelected 
        { 
            get 
            { 
                return _isSelected; 
            } 
            set 
            { 
                _isSelected = value; 
            } 
        } 
        #endregion 
 
        #region 构造函数 
 
        #endregion 
 
        #region 操作 
 
        #region 私有 
        #endregion 
 
        #region 保护 
        /// <summary> 
        /// 对齐到数字 
        /// </summary> 
        /// <param name="number">图形所在的位置的坐标</param> 
        /// <param name="alignNumber">所占表格的大小</param> 
        /// <returns>返回最新的位置坐标</returns> 
        protected int AlignToNumber(int number, int alignNumber) 
        { 
            //通过四舍五路的方法对齐到最近的表格 
            int newNum = number - (number % alignNumber); 
            if ((number - newNum) > (alignNumber / 2)) 
            { 
                return newNum + alignNumber; 
            } 
            else 
            { 
                return newNum; 
            } 
        } 
        #endregion 
 
        #region 公用 
 
        /// <summary> 
        /// 判断鼠标点击出是否有可视化对象 
        /// </summary> 
        /// <param name="x">鼠标所在位置的x轴坐标</param> 
        /// <param name="y">鼠标所在位置的y轴坐标</param> 
        /// <returns>点击出的可视化对象</returns> 
        public virtual HitTestState HitTest(int x, int y) 
        { 
            return HitTestState.None; 
        } 
 
        /// <summary> 
        /// 对齐到画布上的表格 
        /// </summary> 
        public virtual void AlignToGrid() 
        { 
             
        } 
 
        /// <summary> 
        /// 框选 
        /// </summary> 
        /// <param name="rect">选中的矩形范围</param> 
        public virtual void RangeSelect(Rectangle rect) 
        { 
             
        } 
 
        /// <summary> 
        /// 绘制 
        /// </summary> 
        /// <param name="g">绘图图面</param> 
        public virtual void Draw(Graphics g) 
        { 
        } 
 
 
        /// <summary> 
        /// 移动 
        /// </summary> 
        /// <param name="offX">移动新位置的x轴坐标</param> 
        /// <param name="offY">移动新位置的y轴坐标</param> 
        public virtual void Move(int offX, int offY) 
        { 
        } 
 
        /// <summary> 
        /// 打开属性对话框 
        /// </summary> 
        public virtual void OpenPropertyDialog() 
        { 
        } 
 
        /// <summary> 
        /// 图形矩阵 
        /// </summary> 
        /// <returns>返回一个图形矩阵</returns> 
        public virtual Rectangle GetRange() 
        { 
            return new Rectangle(0, 0, 0, 0); 
        } 
        #endregion 
        #endregion 
 
 
 
         
    } 
}