日期:2014-05-18 浏览次数:21062 次
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;                         //streamer io
using System.Runtime.Serialization;     // io
using System.Runtime.Serialization.Formatters.Binary; // io
using System.Drawing.Printing;
namespace EmrKB
{
    public partial class vectShapes : UserControl
    {
        private string Status;
        public string Option;
        private string redimStatus = "";
        private string msg = "";
        [CategoryAttribute("Debug"), DescriptionAttribute("ShowDebugInfo")]
        public bool ShowDebug { get; set; }
        private int startX;
        private int startY;
        private Shapes s;
        private float _Zoom = 1;
        private bool _A4 = true;
        private int _dx = 0;
        private int _dy = 0;
        private int startDX = 0;
        private int startDY = 0;
        private int truestartX = 0;
        private int truestartY = 0;
        //画笔Pen工具 START
        private ArrayList VisPenPointList;
        private ArrayList PenPointList;
        private int PenPrecX;
        private int PenPrecY;
        //画笔Pen工具 END
        private Bitmap offScreenBmp;
        private Bitmap offScreenBackBmp;
        // Grid
        public int _gridSize = 0;
        public bool fit2grid = true;
        //Graphic
        private System.Drawing.Drawing2D.CompositingQuality _CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Default;
        private System.Drawing.Text.TextRenderingHint _TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
        private System.Drawing.Drawing2D.SmoothingMode _SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
        private System.Drawing.Drawing2D.InterpolationMode _InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
        // Drawing Rect
        private bool MouseSx;
        private int tempX;
        private int tempY;
        // 预览 & 打印
        private Anteprima AnteprimaFrm;
        // 编辑框
        private richForm2 editorFrm;
        public RichTextBox r;
        public Color CreationPenColor;
        public float CreationPenWidth;
        public Color CreationFillColor;
        public bool CreationFilled;
        //public PropertyGrid propGrid;
        //EVENT
        public event OptionChanged optionChanged;
        public event ObjectSelected objectSelected;
        //Image1.tif
        Cursor AddPointCur = getCursor("newPoint3.cur", Cursors.Cross);
        Cursor DelPointCur = getCursor("delPoint3.cur", Cursors.Default);
        // Gets he *.cur file in a. 
        public static Cursor getCursor(string a, Cursor defCur)
        {
            try
            {
                return new Cursor(a);
            }
            catch
            {
                return defCur;
            }
        }
        public vectShapes()
        {
            InitializeComponent();
            myInit();
            //from Ilango.M 
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); // added line
        }
        //Graphic
        [CategoryAttribute("Graphics"), DescriptionAttribute("Interp.Mode")]
        public System.Drawing.Drawing2D.InterpolationMode InterpolationMode
        {
            get
            {
                return _InterpolationMode;
            }
            set
            {
                _InterpolationMode = value;
            }
        }
        [CategoryAttribute(&