Beispiel #1
0
        public DocumentForm(string filename)
        {
            InitializeComponent();

            Text = "<New Document>";
            m_data = new DataModel();
            if (filename.Length > 0 && File.Exists(filename) && m_data.Load(filename))
            {
                Text = filename;
                m_filename = filename;
            }

            m_canvas = new CanvasCtrl(this, m_data);
            m_canvas.Dock = DockStyle.Fill;
            Controls.Add(m_canvas);
            m_canvas.SetCenter(new UnitPoint(0, 0));
            m_canvas.RunningSnaps = new Type[]
                {
                typeof(VertextSnapPoint),
                typeof(MidpointSnapPoint),
                typeof(IntersectSnapPoint),
                typeof(QuadrantSnapPoint),
                typeof(CenterSnapPoint),
                typeof(DivisionSnapPoint),
                };

            m_canvas.AddQuickSnapType(Keys.N, typeof(NearestSnapPoint));
            m_canvas.AddQuickSnapType(Keys.M, typeof(MidpointSnapPoint));
            m_canvas.AddQuickSnapType(Keys.I, typeof(IntersectSnapPoint));
            m_canvas.AddQuickSnapType(Keys.V, typeof(VertextSnapPoint));
            m_canvas.AddQuickSnapType(Keys.P, typeof(PerpendicularSnapPoint));
            m_canvas.AddQuickSnapType(Keys.Q, typeof(QuadrantSnapPoint));
            m_canvas.AddQuickSnapType(Keys.C, typeof(CenterSnapPoint));
            m_canvas.AddQuickSnapType(Keys.T, typeof(TangentSnapPoint));
            m_canvas.AddQuickSnapType(Keys.D, typeof(DivisionSnapPoint));

            m_canvas.KeyDown += new KeyEventHandler(OnCanvasKeyDown);
            SetupMenuItems();
            SetupGLMItems();
            SetupDrawTools();
            SetupLayerToolstrip();
            SetupEditTools();
            SetupModuleItems();
            UpdateLayerUI();

            MenuStrip menuitem = new MenuStrip();
            menuitem.Items.Add(m_menuItems.GetMenuStrip("edit"));
            menuitem.Items.Add(m_menuItems.GetMenuStrip("draw"));
            menuitem.Items.Add(m_menuItems.GetMenuStrip("GLM"));
            menuitem.Visible = false;
            Controls.Add(menuitem);
            this.MainMenuStrip = menuitem;
        }
Beispiel #2
0
        string m_filename = string.Empty;           //文件名

        /// <summary>
        /// 文件初始化
        /// </summary>
        /// <param name="filename"></param>
        public DocumentForm(string filename)
        {
            InitializeComponent();

            Text   = "<New Document>";
            m_data = new DataModel();
            if (filename.Length > 0 && File.Exists(filename) && m_data.Load(filename))
            {
                Text       = filename;
                m_filename = filename;
            }

            m_canvas      = new CanvasCtrl(this, m_data);
            m_canvas.Dock = DockStyle.Fill;
            Controls.Add(m_canvas);
            m_canvas.SetCenter(new UnitPoint(0, 0));
            m_canvas.RunningSnaps = new Type[]
            {
                typeof(VertextSnapPoint),
                typeof(MidpointSnapPoint),
                typeof(IntersectSnapPoint),
                typeof(QuadrantSnapPoint),
                typeof(CenterSnapPoint),
                typeof(DivisionSnapPoint),
            };

            m_canvas.AddQuickSnapType(Keys.N, typeof(NearestSnapPoint));
            m_canvas.AddQuickSnapType(Keys.M, typeof(MidpointSnapPoint));
            m_canvas.AddQuickSnapType(Keys.I, typeof(IntersectSnapPoint));
            m_canvas.AddQuickSnapType(Keys.V, typeof(VertextSnapPoint));
            m_canvas.AddQuickSnapType(Keys.P, typeof(PerpendicularSnapPoint));
            m_canvas.AddQuickSnapType(Keys.Q, typeof(QuadrantSnapPoint));
            m_canvas.AddQuickSnapType(Keys.C, typeof(CenterSnapPoint));
            m_canvas.AddQuickSnapType(Keys.T, typeof(TangentSnapPoint));
            m_canvas.AddQuickSnapType(Keys.D, typeof(DivisionSnapPoint));

            m_canvas.KeyDown += new KeyEventHandler(OnCanvasKeyDown);
            SetupMenuItems();
            SetupDrawTools();
            SetupLayerToolstrip();
            SetupEditTools();
            UpdateLayerUI();

            MenuStrip menuitem = new MenuStrip();

            menuitem.Items.Add(m_menuItems.GetMenuStrip("edit"));
            menuitem.Items.Add(m_menuItems.GetMenuStrip("draw"));
            menuitem.Visible = false;
            Controls.Add(menuitem);
            this.MainMenuStrip = menuitem;
        }
Beispiel #3
0
        public void updateActiveProperty(ModuleItems.Property tobeupdated,CanvasCtrl c)
        {
            foreach (object j in m_model.SelectedObjects)
            {
                if (j.GetType().ToString().IndexOf("Module") > 0)
                {
                    ModuleItems.Module temp = j as ModuleItems.Module;
                    foreach (ModuleItems.Property p in temp.Properties) if (p.name == tobeupdated.name) p.value = tobeupdated.value;
                }

            }
            DoInvalidate(true);
        }
Beispiel #4
0
 public CanvasWrapper(CanvasCtrl canvas, Graphics graphics, Rectangle clientrect)
 {
     m_canvas = canvas;
     m_graphics = graphics;
     m_rect = clientrect;
 }
Beispiel #5
0
 public CanvasWrapper(CanvasCtrl canvas)
 {
     m_canvas = canvas;
     m_graphics = null;
     m_rect = new Rectangle();
 }
Beispiel #6
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="canvas"></param>
 /// <param name="graphics"></param>
 /// <param name="clientrect"></param>
 public CanvasWrapper(CanvasCtrl canvas, Graphics graphics, Rectangle clientrect)
 {
     m_canvas   = canvas;
     m_graphics = graphics;
     m_rect     = clientrect;
 }
Beispiel #7
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="canvas"></param>
 public CanvasWrapper(CanvasCtrl canvas)
 {
     m_canvas   = canvas;
     m_graphics = null;
     m_rect     = new Rectangle();
 }
Beispiel #8
0
 public MoveHelper(CanvasCtrl canvas)
 {
     m_canvas = canvas;
 }
Beispiel #9
0
 public MoveHelper(CanvasCtrl canvas)
 {
     m_canvas = canvas;
 }