www.pudn.com > WorkflowDesigner.rar > WfEndActivity.cs, change:2007-11-25,size:2587b


using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Drawing; 
using System.Drawing.Drawing2D; 
using System.Drawing.Imaging; 
namespace WorkflowDesigner.Designer 
{ 
    /// <summary> 
    /// 结束可视化对象 
    /// </summary> 
    public class WfEndActivity:WfAbstractActivity 
    { 
        #region 字段 
 
 
 
        #endregion 
 
        #region 属性 
 
 
        #endregion 
 
        #region 构造函数 
        /// <summary> 
        /// 构造函数 
        /// </summary> 
        public WfEndActivity(int x, int y) 
            : base(x, y) 
        {  
         
        } 
        #endregion 
 
        #region 操作 
 
        #region 私有 
        #endregion 
 
        #region 保护 
        /// <summary> 
        /// 绘制 
        /// </summary> 
        /// <param name="g">绘图图面</param> 
        protected override void DrawIcon(System.Drawing.Graphics g) 
        { 
            Color c; 
            if (IsSelected) 
            { 
                c = Color.Red; 
            } 
            else 
            { 
                c = Color.White; 
            } 
            using (Pen pen = new Pen(c)) 
            { 
                pen.Color = c; 
                g.DrawRectangle(pen, _rect); 
            } 
            using (Brush brush = new SolidBrush(Color.White)) 
            { 
                g.FillRectangle(brush, _rect); 
            } 
            ImageAttributes imAtt = new ImageAttributes(); 
            //设置颜色键 
            imAtt.SetColorKey(Color.FromArgb(255, 0, 255), Color.FromArgb(255, 0, 255)); 
            // 画箭头 
            Bitmap arrowBitmap = WorkflowDesigner.Properties.Resources.end1; 
 
            int imgWidth = arrowBitmap.Width; 
            int imgHeight = arrowBitmap.Height; 
            GraphicsState gs = g.Save(); 
            //绘制图片 
            g.DrawImage(arrowBitmap, _rect, 
                0, 0, 
                imgWidth, 
                imgWidth, 
                GraphicsUnit.Pixel, 
                imAtt); 
            //释放 
            imAtt.Dispose(); 
            arrowBitmap.Dispose(); 
            //还原到原来的表示状态 
            g.Restore(gs); 
 
             
        } 
 
        /// <summary> 
        /// 得到节点类型 
        /// </summary> 
        /// <returns>该节点的类型</returns> 
        protected override string GetActivityType() 
        { 
           //类型0 开始 1 结束 2普通 3 分支 4聚合 
            return "1"; 
        } 
        #endregion 
 
        #region 公用 
 
 
        #endregion 
        #endregion 
 
         
    } 
}