• 大小: 141KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: C#
  • 标签: .net  C#  源代码  GDI+  流程图  

资源简介

C#语言用GDI+实现鼠标绘制流程图的Demo 技术点:GDI+ 序列化与反序列化 拖拽 ToolStrip 应用范围:工作流程图设计器,Visio类似的设计器

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace FlowChartDemo
{
    public partial class frmFlowChart : Form
    {
        public frmFlowChart()
        {
            InitializeComponent();
            this.toolStripButton1.AllowDrop = true;
            this.toolStripButton2.AllowDrop = true;
            this.toolStripButton3.AllowDrop = true;

        }
        string m_itemtype = string.Empty;

        private IPaintItem m_currentitem = null;
        private void Form1_Load(object sender EventArgs e)
        {
        }

        private void paintPanle1_MouseDoubleClick(object sender MouseEventArgs e)
        {
            IPaintItem item = this.paintPanle1.GetItemAtPoint(e.Location);
            if (item != null && item is PaintUnit )
            {
                string itemname = Microsoft.VisualBasic.Interaction.InputBox(“请输入新名称“ “提示“ “未命名“ 100 100);
                item.ItemName = itemname ;
            }
        }

      

        private void paintPanle1_DragDrop(object sender DragEventArgs e)
        {
            string itemtype = e.Data.GetData(typeof(string)).ToString();
            if (itemtype == “A“)
            {
                Point lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
                PaintUnit item = new PaintUnit(“未命名“ FlowChartDemo.Properties.Resources.ContactFlow
                    ItemStatus.Actived
                    new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.ContactFlow.Width / 2
                        e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.ContactFlow.Height / 2) new Pen(Color.Gray) this.Font);
                this.paintPanle1.PaintItems.Add(item);
                this.paintPanle1.Refresh();
            }
            else if (itemtype == “B“)
            {
                Point lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
                PaintUnit item = new PaintUnit(“未命名“ FlowChartDemo.Properties.Resources.GMail
                    ItemStatus.Actived
                    new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.GMail.Width / 2
                        e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.GMail.Height / 2) new Pen(Color.Gray) this.Font);
                this.paintPanle1.PaintItems.Add(item);
                this.paintPanle1.Refresh();
            }
            else if (itemtype == “C“)
            {
                Point lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
                PaintUnit item = new PaintUnit(“未命名“ FlowChartDemo.Properties.Resources.Phone
                    ItemStatus.Actived
                    new Point(e.X - lefttoppoint.X - F

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      57344  2009-11-26 16:44  FlowChartDemo\bin\Debug\FlowChartDemo.exe

     文件      56832  2009-11-26 16:44  FlowChartDemo\bin\Debug\FlowChartDemo.pdb

     文件       5632  2005-11-11 22:25  FlowChartDemo\bin\Debug\FlowChartDemo.vshost.exe

     文件       3949  2009-11-26 16:27  FlowChartDemo\FlowChartDemo.csproj

     文件       8460  2009-11-26 16:44  FlowChartDemo\frmFlowChart.cs

     文件      11649  2009-11-26 16:44  FlowChartDemo\frmFlowChart.designer.cs

     文件       7911  2009-11-26 16:44  FlowChartDemo\frmFlowChart.resx

     文件        393  2009-11-26 16:42  FlowChartDemo\IPaintItem.cs

     文件       1155  2009-11-26 16:44  FlowChartDemo\obj\Debug\FlowChartDemo.csproj.GenerateResource.Cache

     文件      57344  2009-11-26 16:44  FlowChartDemo\obj\Debug\FlowChartDemo.exe

     文件       1158  2009-11-26 16:44  FlowChartDemo\obj\Debug\FlowChartDemo.frmFlowChart.resources

     文件      56832  2009-11-26 16:44  FlowChartDemo\obj\Debug\FlowChartDemo.pdb

     文件      21503  2009-11-26 16:27  FlowChartDemo\obj\Debug\FlowChartDemo.Properties.Resources.resources

     文件       5120  2009-11-26 16:26  FlowChartDemo\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        973  2009-11-26 16:44  FlowChartDemo\obj\FlowChartDemo.csproj.FileListAbsolute.txt

     文件      10454  2009-11-26 16:43  FlowChartDemo\PaintPanel.cs

     文件        479  2009-11-26 16:29  FlowChartDemo\Program.cs

     文件       1204  2009-11-26 16:35  FlowChartDemo\Properties\AssemblyInfo.cs

     文件       4366  2009-11-26 16:26  FlowChartDemo\Properties\Resources.Designer.cs

     文件       7419  2009-11-26 16:26  FlowChartDemo\Properties\Resources.resx

     文件       1098  2009-11-26 15:49  FlowChartDemo\Properties\Settings.Designer.cs

     文件        249  2009-11-26 15:49  FlowChartDemo\Properties\Settings.settings

     文件       3775  2009-11-26 16:26  FlowChartDemo\Resources\Clock1.png

     文件       3367  2009-11-26 16:26  FlowChartDemo\Resources\Clock2.png

     文件       2642  2009-11-26 16:26  FlowChartDemo\Resources\ContactFlow.png

     文件       2919  2009-11-26 16:26  FlowChartDemo\Resources\DropCopy.png

     文件       2931  2009-11-26 16:26  FlowChartDemo\Resources\GMail.png

     文件       2867  2009-11-26 16:26  FlowChartDemo\Resources\Phone.png

     文件       1078  2009-11-26 15:49  FlowChartDemo.sln

    ..A..H.     20992  2009-11-26 16:44  FlowChartDemo.suo

............此处省略12个文件信息

评论

共有 条评论